diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2023-07-03 15:27:08 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2023-07-03 15:27:08 +0000 |
commit | 336444edb1c57b6ba3cf3a6ca83ceadebcfb6952 (patch) | |
tree | c8b5763e32d050905d765680ac207b628af07601 /sbin | |
parent | 7f8415e4527413f35c303b19986ee4c311dd338c (diff) |
An empty string indicates there is no NXTNUM().
Fixes segfault in -e if you happen to delete everything after
a partition line's ":".
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/disklabel/disklabel.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index f419d676bc3..71499830117 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.253 2023/07/03 08:16:36 krw Exp $ */ +/* $OpenBSD: disklabel.c,v 1.254 2023/07/03 15:27:07 krw Exp $ */ /* * Copyright (c) 1987, 1993 @@ -921,7 +921,7 @@ getasciilabel(FILE *f, struct disklabel *lp) } pp = &lp->d_partitions[part]; #define NXTNUM(n, field, errstr) { \ - if (tp == NULL) { \ + if (tp == NULL || *tp == '\0') { \ warnx("line %d: too few fields", lineno); \ errors++; \ break; \ |