Skip to contentSkip to conversation

libfdisk: (dos) Use strtoul to parse the label-id

PATCH Applied Juerg Haefliger 2 participants 2 messages Feb 22, 2019 – Feb 25, 2019 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libfdisk: (dos) Use strtoul to parse the label-id

Parsing of the label-id fails on 32-bit if the MSB is set. Fix that by using strtoul instead of strtol.

---
 libfdisk/src/dos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libfdisk/src/dos.c +1 -1
index 4f81970db9d8..86d15d21130b 100644
@@ -669,7 +669,7 @@ static int dos_create_disklabel(struct fdisk_context *cxt)
 
 		if (s) {
 			errno = 0;
-			id = strtol(s, &end, 16);
+			id = strtoul(s, &end, 16);
 			if (!errno && end && s < end) {
 				has_id = 1;
 				DBG(LABEL, ul_debug("DOS: re-use ID from script (0x%08x)", id));
Signature · 1 line
2.19.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Juerg Haefliger
 libfdisk/src/dos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com