]> 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>
Tue, 2 Apr 2019 10:57:51 +0000 (12:57 +0200)
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 2e46aca70be272f98365e40598cbaa4d9d71fe97..9ed963fb46170d3566c823baf5d2b77525547cde 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));