From: Juerg Haefliger <juerg.haefliger@canonical.com>
To: util-linux@vger.kernel.org
Cc: Juerg Haefliger <juergh@canonical.com>
Subject: [PATCH] libfdisk: (dos) Use strtoul to parse the label-id
Date: Fri, 22 Feb 2019 17:04:12 +0100 [thread overview]
Message-ID: <20190222160412.26652-1-juergh@canonical.com> (raw)
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 4f81970db9d8..86d15d21130b 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -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));
--
2.19.1
next reply other threads:[~2019-02-22 16:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-22 16:04 Juerg Haefliger [this message]
2019-02-25 13:09 ` [PATCH] libfdisk: (dos) Use strtoul to parse the label-id Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190222160412.26652-1-juergh@canonical.com \
--to=juerg.haefliger@canonical.com \
--cc=juergh@canonical.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).