From 14c04d21f5f1b1a8bc5e379ecd90549539eec247 Mon Sep 17 00:00:00 2001 From: krw Date: Sat, 18 Nov 2023 15:42:09 +0000 Subject: [PATCH] Scan past whitespace before checking if flag string starts with "0x". Pointed out by Philippe Meunier. --- sbin/fdisk/cmd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.20.1