diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-12 00:26:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-07-12 00:26:25 +0000 |
commit | 142cea7efbf90f7346eea931c9169fc82d3afa00 (patch) | |
tree | 98526be7cb2652f81eff13482e7ebcbf0156953c /usr.bin/ftp | |
parent | 0ceb5fe1ba873660807cb0c7fe85b746baff2bc1 (diff) |
malloc/strdup failure not handled; cloder@acm.org
Diffstat (limited to 'usr.bin/ftp')
-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 |
3 files changed, 13 insertions, 9 deletions
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); } |