diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-09-22 19:50:29 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-09-22 19:50:29 +0000 |
commit | 99b0cb76e2303dd1d20a32461a8ab6aa1b70e0aa (patch) | |
tree | ce856d8c2b2f179b7fae887655042cb17ecce69a | |
parent | 99ea75176dd9635ccda2c427de2014c2db4272a9 (diff) |
Revert to my version of buildfname(). Allman's didn't work, ya know?
Also fix a slight buffer overflow in get_column(), pointed out by Allman.
-rw-r--r-- | usr.sbin/sendmail/src/util.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/sendmail/src/util.c b/usr.sbin/sendmail/src/util.c index 13a9f50ea65..2a77fad6b67 100644 --- a/usr.sbin/sendmail/src/util.c +++ b/usr.sbin/sendmail/src/util.c @@ -384,11 +384,11 @@ makelower(p) */ void -buildfname(gecos, login, buf, buflen) +buildfname(gecos, login, buf, bufsiz) register char *gecos; char *login; char *buf; - int buflen; + int bufsiz; { register char *p; register char *bp = buf; @@ -397,13 +397,13 @@ buildfname(gecos, login, buf, buflen) gecos++; for (p = gecos; *p != '\0' && *p != ',' && *p != ';' && *p != '%' - && ((bp - buf) <= (buflen - 1)); p++) + && ((bp - buf) <= (bufsiz - 1)); p++) { if (*p == '&') { - snprintf(bp, SPACELEFT(buf, bp), "%s", login); + (void) strncpy(bp, login, (bufsiz - (bp - buf) - 1)); + buf[bufsiz - 1] = '\0'; *bp = toupper(*bp); - bp += strlen(bp); while (*bp != '\0') bp++; } @@ -1869,7 +1869,7 @@ get_column(line, col, delim, buf, buflen) char *p; char *begin, *end; int i; - char delimbuf[3]; + char delimbuf[4]; if (delim == '\0') strcpy(delimbuf, "\n\t "); |