summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/common_source/startdaemon.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-10-25 19:38:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-10-25 19:38:24 +0000
commit54d9c030a9eb88aec5d7bca3eddad4a71b52ed1f (patch)
tree26398a3548b72884d9e7f88f1e303d772bd8ff91 /usr.sbin/lpr/common_source/startdaemon.c
parentcf129a78e19c51cae5e0dcb02628e09c4ef90191 (diff)
proactive bounds checking; help from millert
Diffstat (limited to 'usr.sbin/lpr/common_source/startdaemon.c')
-rw-r--r--usr.sbin/lpr/common_source/startdaemon.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.sbin/lpr/common_source/startdaemon.c b/usr.sbin/lpr/common_source/startdaemon.c
index 930afc341de..4f3ec34c7f9 100644
--- a/usr.sbin/lpr/common_source/startdaemon.c
+++ b/usr.sbin/lpr/common_source/startdaemon.c
@@ -83,7 +83,10 @@ startdaemon(printer)
return(0);
}
seteuid(uid);
- (void) sprintf(buf, "\1%s\n", printer);
+ if (snprintf(buf, sizeof buf, "\1%s\n", printer) > sizeof buf-1) {
+ close(s);
+ return (0);
+ }
n = strlen(buf);
if (write(s, buf, n) != n) {
perr("write");