diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2000-11-12 10:55:35 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2000-11-12 10:55:35 +0000 |
commit | cf9f174823c884fd5ca80ac1be5b7174f43fe695 (patch) | |
tree | 076199039708b1b3c37578329d27682b290e8fbf | |
parent | 3f9f11197b532359072084e17c48fa9301ac4669 (diff) | |
download | FreeBSD-src-cf9f174823c884fd5ca80ac1be5b7174f43fe695.zip FreeBSD-src-cf9f174823c884fd5ca80ac1be5b7174f43fe695.tar.gz |
Check the return value of strdup
Submitted by: Chris Faulhaber <jedgar@fxp.org>
-rw-r--r-- | usr.sbin/usbd/usbd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.sbin/usbd/usbd.c b/usr.sbin/usbd/usbd.c index 033c22c..7697196 100644 --- a/usr.sbin/usbd/usbd.c +++ b/usr.sbin/usbd/usbd.c @@ -913,6 +913,10 @@ main(int argc, char **argv) switch(ch) { case 'c': configfile = strdup(optarg); + if (configfile == NULL) { + fprintf(stderr, "strdup returned NULL\n"); + return 1; + } break; case 'd': debug++; @@ -949,6 +953,10 @@ main(int argc, char **argv) fds[ndevs] = open(buf, O_RDWR); if (fds[ndevs] >= 0) { devs[ndevs] = strdup(buf); + if (devs[ndevs] == NULL) { + fprintf(stderr, "strdup returned NULL\n"); + return 1; + } if (verbose) printf("%s: opened %s\n", __progname, devs[ndevs]); |