summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/common.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1996-10-25 19:38:19 +0000
committerderaadt <deraadt@openbsd.org>1996-10-25 19:38:19 +0000
commit5c6eaf08f9aaecf9a50faeaf0cb4087a2236a015 (patch)
treef53f2bdcea3d72c7764e1e4776507b9564f927a7 /usr.sbin/lpr/common_source/common.c
parentfix; pr#38; kstailey@dol-esa.gov (diff)
downloadwireguard-openbsd-5c6eaf08f9aaecf9a50faeaf0cb4087a2236a015.tar.xz
wireguard-openbsd-5c6eaf08f9aaecf9a50faeaf0cb4087a2236a015.zip
proactive bounds checking; help from millert
Diffstat (limited to 'usr.sbin/lpr/common_source/common.c')
-rw-r--r--usr.sbin/lpr/common_source/common.c4
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 6d48d7b1768..ae26013e0cf 100644
--- a/usr.sbin/lpr/common_source/common.c
+++ b/usr.sbin/lpr/common_source/common.c
@@ -197,14 +197,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;