From: krw Date: Mon, 3 Jul 2023 15:27:07 +0000 (+0000) Subject: An empty string indicates there is no NXTNUM(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=498920cd2d5237762f0f01d47540b1ce451b28cf;p=openbsd An empty string indicates there is no NXTNUM(). Fixes segfault in -e if you happen to delete everything after a partition line's ":". --- 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; \