summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormickey <mickey@openbsd.org>1996-07-12 07:23:59 +0000
committermickey <mickey@openbsd.org>1996-07-12 07:23:59 +0000
commit139546eb2170bd3a1764d62be04118edd954611c (patch)
treed8460147acdc83446f5ee721763d1dddb6b9b3d1
parentdo not ask for password if none set; from freebsd (diff)
downloadwireguard-openbsd-139546eb2170bd3a1764d62be04118edd954611c.tar.xz
wireguard-openbsd-139546eb2170bd3a1764d62be04118edd954611c.zip
better fix for buffer overrun
-rw-r--r--usr.bin/rdist/lookup.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.bin/rdist/lookup.c b/usr.bin/rdist/lookup.c
index 8e00670d104..81cb98510ba 100644
--- a/usr.bin/rdist/lookup.c
+++ b/usr.bin/rdist/lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lookup.c,v 1.5 1996/07/11 11:57:09 mickey Exp $ */
+/* $OpenBSD: lookup.c,v 1.6 1996/07/12 07:23:59 mickey Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: lookup.c,v 1.5 1996/07/11 11:57:09 mickey Exp $";
+"$OpenBSD: lookup.c,v 1.6 1996/07/12 07:23:59 mickey Exp $";
static char sccsid[] = "@(#)lookup.c 5.1 (Berkeley) 6/6/85";
@@ -138,8 +138,6 @@ lookup(name, action, value) /* %% in name. Ignore quotas in name */
debugmsg(DM_CALL, "lookup(%s, %d, %x)", name, action, value);
- if (strlen(name) > sizeof(ebuf)-12)
- yyerror("name is too long");
n = 0;
for (cp = name; *cp; )
n += *cp++;
@@ -150,7 +148,7 @@ lookup(name, action, value) /* %% in name. Ignore quotas in name */
continue;
if (action != LOOKUP) {
if (action != INSERT || s->s_type != CONST) {
- (void) sprintf(ebuf, "%s redefined", name);
+ (void) snprintf(ebuf, sizeof(ebuf), "%s redefined", name);
yyerror(ebuf);
}
}
@@ -158,7 +156,7 @@ lookup(name, action, value) /* %% in name. Ignore quotas in name */
}
if (action == LOOKUP) {
- (void) sprintf(ebuf, "%s undefined", name);
+ (void) snprintf(ebuf, sizeof(ebuf), "%s undefined", name);
yyerror(ebuf);
return(NULL);
}