diff options
author | pst <pst@FreeBSD.org> | 1994-09-26 04:45:11 +0000 |
---|---|---|
committer | pst <pst@FreeBSD.org> | 1994-09-26 04:45:11 +0000 |
commit | f37e6d1e5de7c658b8eab4fef2567ee7c369fdb4 (patch) | |
tree | 2a398f6d712b50c19b8a3ce3a660ce1bd3b3b3cc /sbin/disklabel | |
parent | d780af9d2a167ec15199c9a4ce807a66de841939 (diff) | |
download | FreeBSD-src-f37e6d1e5de7c658b8eab4fef2567ee7c369fdb4.zip FreeBSD-src-f37e6d1e5de7c658b8eab4fef2567ee7c369fdb4.tar.gz |
disklabel will dump core if you give it too few numbers to process
Obtained from: NetBSD misc/490 - John Kohl
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/disklabel.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 4a29340..0914af2 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1054,10 +1054,16 @@ getasciilabel(f, lp) } pp = &lp->d_partitions[part]; #define NXTNUM(n) { \ - cp = tp, tp = word(cp); \ - if (tp == NULL) \ - tp = cp; \ - (n) = atoi(cp); \ + if (tp == NULL) { \ + fprintf(stderr, "line %d: too few numeric fields\n", lineno); \ + errors++; \ + break; \ + } else { \ + cp = tp, tp = word(cp); \ + if (tp == NULL) \ + tp = cp; \ + (n) = atoi(cp); \ + } \ } NXTNUM(v); |