diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-09-15 22:58:10 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-09-15 22:58:10 +0000 |
commit | 940b14abb425d608a4f941c7873f0656ac64b452 (patch) | |
tree | c940a773b08bfe9826ef12a6aa0e8ccad4edfc9e /bin | |
parent | 186adabdffcd89165bbd1c591f4081e23316cce3 (diff) |
sprintf -> snprintf paranoia
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/mkinit.c | 6 | ||||
-rw-r--r-- | bin/sh/mknodes.c | 12 | ||||
-rw-r--r-- | bin/sh/mksyntax.c | 9 |
3 files changed, 14 insertions, 13 deletions
diff --git a/bin/sh/mkinit.c b/bin/sh/mkinit.c index 8a5df1ff9d0..9750b99813c 100644 --- a/bin/sh/mkinit.c +++ b/bin/sh/mkinit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkinit.c,v 1.3 1996/06/23 14:21:23 deraadt Exp $ */ +/* $OpenBSD: mkinit.c,v 1.4 1996/09/15 22:58:09 millert Exp $ */ /* $NetBSD: mkinit.c,v 1.14 1996/02/18 12:29:21 mycroft Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mkinit.c 8.2 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: mkinit.c,v 1.3 1996/06/23 14:21:23 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mkinit.c,v 1.4 1996/09/15 22:58:09 millert Exp $"; #endif #endif /* not lint */ @@ -275,7 +275,7 @@ doevent(ep, fp, fname) int indent; char *p; - sprintf(line, "\n /* from %s: */\n", fname); + snprintf(line, sizeof(line), "\n /* from %s: */\n", fname); addstr(line, &ep->code); addstr(" {\n", &ep->code); for (;;) { diff --git a/bin/sh/mknodes.c b/bin/sh/mknodes.c index ddf3dc2b2e3..ef4cc33c706 100644 --- a/bin/sh/mknodes.c +++ b/bin/sh/mknodes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mknodes.c,v 1.2 1996/06/23 14:21:24 deraadt Exp $ */ +/* $OpenBSD: mknodes.c,v 1.3 1996/09/15 22:58:09 millert Exp $ */ /* $NetBSD: mknodes.c,v 1.11 1995/05/11 21:29:36 christos Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mknodes.c 8.2 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: mknodes.c,v 1.2 1996/06/23 14:21:24 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mknodes.c,v 1.3 1996/09/15 22:58:09 millert Exp $"; #endif #endif /* not lint */ @@ -187,16 +187,16 @@ parsefield() fp->name = savestr(name); if (strcmp(type, "nodeptr") == 0) { fp->type = T_NODE; - sprintf(decl, "union node *%s", name); + snprintf(decl, sizeof(decl), "union node *%s", name); } else if (strcmp(type, "nodelist") == 0) { fp->type = T_NODELIST; - sprintf(decl, "struct nodelist *%s", name); + snprintf(decl, sizeof(decl), "struct nodelist *%s", name); } else if (strcmp(type, "string") == 0) { fp->type = T_STRING; - sprintf(decl, "char *%s", name); + snprintf(decl, sizeof(decl), "char *%s", name); } else if (strcmp(type, "int") == 0) { fp->type = T_INT; - sprintf(decl, "int %s", name); + snprintf(decl, sizeof(decl), "int %s", name); } else if (strcmp(type, "other") == 0) { fp->type = T_OTHER; } else if (strcmp(type, "temp") == 0) { diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index 947e7090a99..5506ba70623 100644 --- a/bin/sh/mksyntax.c +++ b/bin/sh/mksyntax.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mksyntax.c,v 1.2 1996/06/23 14:21:24 deraadt Exp $ */ +/* $OpenBSD: mksyntax.c,v 1.3 1996/09/15 22:58:08 millert Exp $ */ /* $NetBSD: mksyntax.c,v 1.11 1995/05/11 21:29:37 christos Exp $ */ /*- @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)mksyntax.c 8.2 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: mksyntax.c,v 1.2 1996/06/23 14:21:24 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: mksyntax.c,v 1.3 1996/09/15 22:58:08 millert Exp $"; #endif #endif /* not lint */ @@ -176,7 +176,7 @@ main(argc, argv) /* Generate the #define statements in the header file */ fputs("/* Syntax classes */\n", hfile); for (i = 0 ; synclass[i].name ; i++) { - sprintf(buf, "#define %s %d", synclass[i].name, i); + snprintf(buf, sizeof(buf), "#define %s %d", synclass[i].name, i); fputs(buf, hfile); for (pos = strlen(buf) ; pos < 32 ; pos = (pos + 8) & ~07) putc('\t', hfile); @@ -185,7 +185,8 @@ main(argc, argv) putc('\n', hfile); fputs("/* Syntax classes for is_ functions */\n", hfile); for (i = 0 ; is_entry[i].name ; i++) { - sprintf(buf, "#define %s %#o", is_entry[i].name, 1 << i); + snprintf(buf, sizeof(buf), "#define %s %#o", + is_entry[i].name, 1 << i); fputs(buf, hfile); for (pos = strlen(buf) ; pos < 32 ; pos = (pos + 8) & ~07) putc('\t', hfile); |