From: krw Date: Sat, 18 Nov 2023 15:42:09 +0000 (+0000) Subject: Scan past whitespace before checking if flag string starts X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=14c04d21f5f1b1a8bc5e379ecd90549539eec247;p=openbsd Scan past whitespace before checking if flag string starts with "0x". Pointed out by Philippe Meunier. --- diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index fa0399ec74f..c1765db4785 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.178 2023/11/10 16:20:52 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.179 2023/11/18 15:42:09 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -181,6 +181,7 @@ parseflag(const char *flagstr, uint64_t *flagvalue) char *ep; uint64_t val; + flagstr += strspn(flagstr, WHITESPACE); if (flagstr[0] == '0' && (flagstr[1] == 'x' || flagstr[1] == 'X')) { errno = 0; val = strtoull(flagstr, &ep, 16);