diff options
author | phk <phk@FreeBSD.org> | 1995-04-28 04:58:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-04-28 04:58:19 +0000 |
commit | 9de92bdb39bd36504361c1457d344fa7775720ad (patch) | |
tree | 1ba45dbcd2112b1f28feabeb7d2781791dc234ec /usr.sbin/kernbb | |
parent | 10f3651c015a937f7eaea0f530561f6f4cf1d04d (diff) | |
download | FreeBSD-src-9de92bdb39bd36504361c1457d344fa7775720ad.zip FreeBSD-src-9de92bdb39bd36504361c1457d344fa7775720ad.tar.gz |
Don't dereference NULL pointers.
Diffstat (limited to 'usr.sbin/kernbb')
-rw-r--r-- | usr.sbin/kernbb/kernbb.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/kernbb/kernbb.c b/usr.sbin/kernbb/kernbb.c index c7b4ae1..72b5bc1 100644 --- a/usr.sbin/kernbb/kernbb.c +++ b/usr.sbin/kernbb/kernbb.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: kernbb.c,v 1.1 1995/03/10 08:53:55 phk Exp $ * */ @@ -82,7 +82,7 @@ main() continue; doit: for (i=0; i < bb.ncounts; i++) { - if (!pn[i]) { + if (!pn[i] && func[i]) { kvm_read(kv,func[i], buf, sizeof buf); buf[sizeof buf -1] = 0; pn[i] = malloc(strlen(buf)+1); @@ -93,7 +93,9 @@ main() func[j] = 0; } } - if (!fn[i]) { + if (!pn[i]) + pn[i] = "-"; + if (!fn[i] && file[i]) { kvm_read(kv,file[i], buf, sizeof buf); buf[sizeof buf -1] = 0; fn[i] = malloc(strlen(buf)+1); @@ -104,6 +106,8 @@ main() file[j] = 0; } } + if (!fn[i]) + fn[i] = "-"; printf("%s %5u %s %u %u\n", fn[i],lineno[i],pn[i],addr[i],counts[i]); } |