diff options
author | imp <imp@FreeBSD.org> | 1997-07-29 04:17:19 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1997-07-29 04:17:19 +0000 |
commit | b1debf973d6a489bfe9c6511c94e356d6c024a47 (patch) | |
tree | 58de2e9f99438beeb37077a12a91d565f0aa5ae0 /usr.sbin/lpr/common_source/common.c | |
parent | 62296c6450c3104df51d51aa47ad4b74faae7e6b (diff) | |
download | FreeBSD-src-b1debf973d6a489bfe9c6511c94e356d6c024a47.zip FreeBSD-src-b1debf973d6a489bfe9c6511c94e356d6c024a47.tar.gz |
Fix boatloads of buffer overflows from the OpenBSD tree.
Be pedantic about always using sizeof(blah) vs sizeof (blah) or sizeof blah.
Obtained from:OpenBSD
Diffstat (limited to 'usr.sbin/lpr/common_source/common.c')
-rw-r--r-- | usr.sbin/lpr/common_source/common.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 8c77774..6cb4098 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -193,14 +193,14 @@ getline(cfp) register char *lp = line; register c; - while ((c = getc(cfp)) != '\n') { + while ((c = getc(cfp)) != '\n' && linel+1 < sizeof(line)) { if (c == EOF) return(0); if (c == '\t') { do { *lp++ = ' '; linel++; - } while ((linel & 07) != 0); + } while ((linel & 07) != 0 && linel+1 < sizeof(line)); continue; } *lp++ = c; |