diff options
author | 1996-09-24 04:19:25 +0000 | |
---|---|---|
committer | 1996-09-24 04:19:25 +0000 | |
commit | 7ecb9955a5f2f48912d6fd800425e110cb0501e4 (patch) | |
tree | e10a4b9766dabd0258b50f0aab3e0a23fe1db6a5 /usr.bin/patch/inp.c | |
parent | Use mkstemp(). Since temp files get re-used we use mkstemp() to make (diff) | |
download | wireguard-openbsd-7ecb9955a5f2f48912d6fd800425e110cb0501e4.tar.xz wireguard-openbsd-7ecb9955a5f2f48912d6fd800425e110cb0501e4.zip |
sprintf -> snprintf except where guaranteed safe.
Diffstat (limited to 'usr.bin/patch/inp.c')
-rw-r--r-- | usr.bin/patch/inp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c index 86c3b3759a6..d3917a88de0 100644 --- a/usr.bin/patch/inp.c +++ b/usr.bin/patch/inp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: inp.c,v 1.4 1996/07/01 20:40:07 deraadt Exp $ */ +/* $OpenBSD: inp.c,v 1.5 1996/09/24 04:19:26 millert Exp $ */ #ifndef lint -static char rcsid[] = "$OpenBSD: inp.c,v 1.4 1996/07/01 20:40:07 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: inp.c,v 1.5 1996/09/24 04:19:26 millert Exp $"; #endif /* not lint */ #include "EXTERN.h" @@ -103,17 +103,17 @@ char *filename; s = lbuf + 20; strncpy(s, filename, pathlen); -#define try(f, a1, a2) (Sprintf(s + pathlen, f, a1, a2), stat(s, &cstat) == 0) +#define try(f, a1, a2) (Snprintf(s + pathlen, sizeof lbuf - (s + pathlen - lbuf), f, a1, a2), stat(s, &cstat) == 0) if ( try("RCS/%s%s", filebase, RCSSUFFIX) || try("RCS/%s" , filebase, 0) || try( "%s%s", filebase, RCSSUFFIX)) { - Sprintf(buf, CHECKOUT, filename); - Sprintf(lbuf, RCSDIFF, filename); + Snprintf(buf, sizeof buf, CHECKOUT, filename); + Snprintf(lbuf, sizeof lbuf, RCSDIFF, filename); cs = "RCS"; } else if ( try("SCCS/%s%s", SCCSPREFIX, filebase) || try( "%s%s", SCCSPREFIX, filebase)) { - Sprintf(buf, GET, s); - Sprintf(lbuf, SCCSDIFF, s, filename); + Snprintf(buf, sizeof buf, GET, s); + Snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename); cs = "SCCS"; } else if (statfailed) fatal2("can't find %s\n", filename); |