summaryrefslogtreecommitdiffstats
path: root/usr.bin/units/units.c
diff options
context:
space:
mode:
authorray <ray@openbsd.org>2007-02-20 01:44:16 +0000
committerray <ray@openbsd.org>2007-02-20 01:44:16 +0000
commit0420c874a690622bb92bd10a07d234035b0874ed (patch)
tree13705e7bcb87d504ab07d5abfe98d4025b5c3e8c /usr.bin/units/units.c
parentknf found while fixing another bug (diff)
downloadwireguard-openbsd-0420c874a690622bb92bd10a07d234035b0874ed.tar.xz
wireguard-openbsd-0420c874a690622bb92bd10a07d234035b0874ed.zip
Change hard coded numbers to sizeof(buf). Also change some
sizeof(buf) - 1 to sizeof(buf), since fgets takes the whole buffer size. Based on diff from Charles Longeau <chl at tuxfamily dot org> long ago. OK millert@.
Diffstat (limited to 'usr.bin/units/units.c')
-rw-r--r--usr.bin/units/units.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c
index 09399bf6094..8335c156db4 100644
--- a/usr.bin/units/units.c
+++ b/usr.bin/units/units.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: units.c,v 1.11 2004/12/02 22:54:55 pat Exp $ */
+/* $OpenBSD: units.c,v 1.12 2007/02/20 01:56:12 ray Exp $ */
/* $NetBSD: units.c,v 1.6 1996/04/06 06:01:03 thorpej Exp $ */
/*
@@ -153,7 +153,7 @@ readunits(char *userfile)
}
}
while (!feof(unitfile)) {
- if (!fgets(line, 79, unitfile))
+ if (!fgets(line, sizeof(line), unitfile))
break;
linenum++;
lineptr = line;
@@ -713,7 +713,7 @@ main(int argc, char **argv)
initializeunit(&have);
if (!quiet)
printf("You have: ");
- if (!fgets(havestr, 80, stdin)) {
+ if (!fgets(havestr, sizeof(havestr), stdin)) {
if (!quiet)
putchar('\n');
exit(0);
@@ -724,7 +724,7 @@ main(int argc, char **argv)
initializeunit(&want);
if (!quiet)
printf("You want: ");
- if (!fgets(wantstr, 80, stdin)) {
+ if (!fgets(wantstr, sizeof(wantstr), stdin)) {
if (!quiet)
putchar('\n');
exit(0);