diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/fgen/fgen.l | 61 | ||||
-rw-r--r-- | usr.bin/ftp/cmds.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/stringlist.c | 10 | ||||
-rw-r--r-- | usr.bin/ftp/util.c | 6 | ||||
-rw-r--r-- | usr.bin/pmdb/break.c | 5 | ||||
-rw-r--r-- | usr.bin/pmdb/clit.c | 4 |
6 files changed, 80 insertions, 12 deletions
diff --git a/usr.bin/fgen/fgen.l b/usr.bin/fgen/fgen.l index 414e38091fb..f1f3b375a1f 100644 --- a/usr.bin/fgen/fgen.l +++ b/usr.bin/fgen/fgen.l @@ -1,5 +1,5 @@ %{ -/* $OpenBSD: fgen.l,v 1.4 2002/06/18 03:22:15 jason Exp $ */ +/* $OpenBSD: fgen.l,v 1.5 2002/07/12 00:26:24 deraadt Exp $ */ /* $NetBSD: fgen.l,v 1.12 2001/06/13 10:46:05 wiz Exp $ */ /* FLEX input for FORTH input file scanner */ /* @@ -991,6 +991,9 @@ main(argc, argv) initdic(); outbufsiz = BUFCLICK; outbuf = malloc(outbufsiz); + if (outbuf == NULL) + (void)err(1, "out of memory"); + fheader = (struct fcode_header *)outbuf; outpos = 0; emit(hdrtype); @@ -1152,8 +1155,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + if (!fadd(dictionary, fcode)) token_err(yylineno, infile, NULL, "Duplicate definition: `%s'\n", fcode->name); @@ -1214,13 +1223,22 @@ tokenize(input) token->type); } alias = malloc(sizeof(*alias)); + if (alias == NULL) + (void)err(1, "out of memory"); + alias->name = strdup(token->text); + if (alias->name == NULL) + (void)err(1, "out of memory"); + token = yylex(); if (token == NULL) { (void)printf( "EOF in alias definition\n"); return; } alias->equiv = strdup(token->text); + if (alias->equiv == NULL) + (void)err(1, "out of memory"); + if (!aadd(aliases, alias)) { (void)printf( "ERROR: Duplicate alias %s\n", alias->name); @@ -1272,8 +1290,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) @@ -1305,8 +1329,13 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) @@ -1346,8 +1375,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) @@ -1415,8 +1450,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) @@ -1551,8 +1592,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) @@ -1782,8 +1829,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) @@ -1810,8 +1863,14 @@ tokenize(input) /* Add new code to dictionary */ fcode = malloc(sizeof(*fcode)); + if (fcode == NULL) + (void)err(1, "out of memory"); + fcode->num = nextfcode++; fcode->name = strdup(token->text); + if (fcode->name == NULL) + (void)err(1, "out of memory"); + fadd(dictionary, fcode); if (state == 0) diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 28e589269fe..a64df14342e 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.40 2002/01/04 16:18:59 art Exp $ */ +/* $OpenBSD: cmds.c,v 1.41 2002/07/12 00:25:30 deraadt Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -67,7 +67,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$OpenBSD: cmds.c,v 1.40 2002/01/04 16:18:59 art Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.41 2002/07/12 00:25:30 deraadt Exp $"; #endif #endif /* not lint */ @@ -935,6 +935,8 @@ setgate(argc, argv) gateport = htons(port); #else gateport = strdup(argv[2]); + if (gateport == NULL) + err(1, NULL); #endif } strlcpy(gsbuf, argv[1], sizeof(gsbuf)); diff --git a/usr.bin/ftp/stringlist.c b/usr.bin/ftp/stringlist.c index 9abfc540ad5..63320e7590a 100644 --- a/usr.bin/ftp/stringlist.c +++ b/usr.bin/ftp/stringlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stringlist.c,v 1.2 1997/07/25 21:56:23 millert Exp $ */ +/* $OpenBSD: stringlist.c,v 1.3 2002/07/12 00:25:30 deraadt Exp $ */ /* $NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $ */ /* @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: stringlist.c,v 1.2 1997/07/25 21:56:23 millert Exp $"; +static char *rcsid = "$OpenBSD: stringlist.c,v 1.3 2002/07/12 00:25:30 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <stdio.h> @@ -53,13 +53,13 @@ sl_init() { StringList *sl = malloc(sizeof(StringList)); if (sl == NULL) - err(1, "stringlist: %m"); + err(1, "stringlist"); sl->sl_cur = 0; sl->sl_max = _SL_CHUNKSIZE; sl->sl_str = malloc(sl->sl_max * sizeof(char *)); if (sl->sl_str == NULL) - err(1, "stringlist: %m"); + err(1, "stringlist"); return sl; } @@ -76,7 +76,7 @@ sl_add(sl, name) sl->sl_max += _SL_CHUNKSIZE; sl->sl_str = realloc(sl->sl_str, sl->sl_max * sizeof(char *)); if (sl->sl_str == NULL) - err(1, "stringlist: %m"); + err(1, "stringlist"); } sl->sl_str[sl->sl_cur++] = name; } diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c index 365dd32012b..3874a50c655 100644 --- a/usr.bin/ftp/util.c +++ b/usr.bin/ftp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.29 2002/03/30 17:45:44 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.30 2002/07/12 00:25:30 deraadt Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /* @@ -35,7 +35,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: util.c,v 1.29 2002/03/30 17:45:44 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: util.c,v 1.30 2002/07/12 00:25:30 deraadt Exp $"; #endif /* not lint */ /* @@ -507,6 +507,8 @@ globulize(cpp) * free(*cpp) if that is the case */ *cpp = strdup(gl.gl_pathv[0]); + if (*cpp == NULL) + err(1, NULL); globfree(&gl); return (1); } diff --git a/usr.bin/pmdb/break.c b/usr.bin/pmdb/break.c index 3cd4ae5e8c4..1e2455297ca 100644 --- a/usr.bin/pmdb/break.c +++ b/usr.bin/pmdb/break.c @@ -1,4 +1,4 @@ -/* $OpenBSD: break.c,v 1.2 2002/03/15 16:41:06 jason Exp $ */ +/* $OpenBSD: break.c,v 1.3 2002/07/12 00:24:53 deraadt Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -187,6 +187,9 @@ bkpt_check(struct pstate *ps) * of the callbacks require a stop. */ rg = alloca(sizeof(*rg) * md_def.nregs); + if (rg == NULL) + err(1, "bkpt_check: Can't allocate stack space."); + if (md_getregs(ps, rg)) err(1, "bkpt_check: Can't get registers."); diff --git a/usr.bin/pmdb/clit.c b/usr.bin/pmdb/clit.c index bb05e321306..d73e571cea6 100644 --- a/usr.bin/pmdb/clit.c +++ b/usr.bin/pmdb/clit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clit.c,v 1.2 2002/03/15 16:41:06 jason Exp $ */ +/* $OpenBSD: clit.c,v 1.3 2002/07/12 00:24:53 deraadt Exp $ */ /* * Copyright (c) 2002 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -216,6 +216,8 @@ cmdloop(void *arg) #endif orgline = line = strdup(elline); + if (line == NULL) + err(1, "strdup"); argc = 0; for (ap = argv; (*ap = strsep(&line, " \t\n")) != NULL;) { |