diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/bsdlabel/bsdlabel.c | 14 | ||||
-rw-r--r-- | sbin/disklabel/disklabel.c | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 4a29340..0914af2 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.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); 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); |