summaryrefslogtreecommitdiff
path: root/bin/ed/glbl.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-09-15 22:25:59 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-09-15 22:25:59 +0000
commit733966b6e5cfde760f42ebed60f7e0efeeddf8cb (patch)
tree548a078905be8e1a2203de6ba51212c3c5a99a13 /bin/ed/glbl.c
parentecc60413067be65a5816bbc9c21e9e389b2d6fac (diff)
sprintf -> snprintf paranoia
Diffstat (limited to 'bin/ed/glbl.c')
-rw-r--r--bin/ed/glbl.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c
index 736637994c1..3cbebd97758 100644
--- a/bin/ed/glbl.c
+++ b/bin/ed/glbl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glbl.c,v 1.2 1996/06/23 14:20:01 deraadt Exp $ */
+/* $OpenBSD: glbl.c,v 1.3 1996/09/15 22:25:55 millert Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
@@ -33,7 +33,7 @@
#if 0
static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: glbl.c,v 1.2 1996/06/23 14:20:01 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: glbl.c,v 1.3 1996/09/15 22:25:55 millert Exp $";
#endif
#endif /* not lint */
@@ -55,7 +55,7 @@ build_active_list(isgcmd)
char delimiter;
if ((delimiter = *ibufp) == ' ' || delimiter == '\n') {
- sprintf(errmsg, "invalid pattern delimiter");
+ snprintf(errmsg, sizeof(errmsg), "invalid pattern delimiter");
return ERR;
} else if ((pat = get_compiled_pattern()) == NULL)
return ERR;
@@ -115,13 +115,15 @@ exec_global(interact, gflag)
if (n < 0)
return ERR;
else if (n == 0) {
- sprintf(errmsg, "unexpected end-of-file");
+ snprintf(errmsg, sizeof(errmsg),
+ "unexpected end-of-file");
return ERR;
} else if (n == 1 && !strcmp(ibuf, "\n"))
continue;
else if (n == 2 && !strcmp(ibuf, "&\n")) {
if (cmd == NULL) {
- sprintf(errmsg, "no previous command");
+ snprintf(errmsg, sizeof(errmsg),
+ "no previous command");
return ERR;
} else cmd = ocmd;
} else if ((cmd = get_extended_line(&n, 0)) == NULL)
@@ -166,7 +168,7 @@ set_active_node(lp)
if ((ts = (line_t **) realloc(active_list,
(ti += MINBUFSZ) * sizeof(line_t **))) == NULL) {
fprintf(stderr, "%s\n", strerror(errno));
- sprintf(errmsg, "out of memory");
+ snprintf(errmsg, sizeof(errmsg), "out of memory");
SPL0();
return ERR;
}
@@ -175,7 +177,7 @@ set_active_node(lp)
if ((ts = (line_t **) malloc((ti += MINBUFSZ) *
sizeof(line_t **))) == NULL) {
fprintf(stderr, "%s\n", strerror(errno));
- sprintf(errmsg, "out of memory");
+ snprintf(errmsg, sizeof(errmsg), "out of memory");
SPL0();
return ERR;
}