]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (dos) Use strtoul to parse the label-id
authorJuerg Haefliger <juerg.haefliger@canonical.com>
Fri, 22 Feb 2019 16:04:12 +0000 (17:04 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 25 Feb 2019 13:08:56 +0000 (14:08 +0100)
Parsing of the label-id fails on 32-bit if the MSB is set. Fix that by
using strtoul instead of strtol.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
libfdisk/src/dos.c

index fa139a51d6454718e398ab144136d5b6fcbace5b..fba95371295a41c3df82c790d21511fd94d8aebf 100644 (file)
@@ -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));