util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libfdisk: (dos) Use strtoul to parse the label-id
@ 2019-02-22 16:04 Juerg Haefliger
  2019-02-25 13:09 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Juerg Haefliger @ 2019-02-22 16:04 UTC (permalink / raw)
  To: util-linux; +Cc: Juerg Haefliger

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libfdisk: (dos) Use strtoul to parse the label-id
  2019-02-22 16:04 [PATCH] libfdisk: (dos) Use strtoul to parse the label-id Juerg Haefliger
@ 2019-02-25 13:09 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2019-02-25 13:09 UTC (permalink / raw)
  To: Juerg Haefliger; +Cc: util-linux, Juerg Haefliger

On Fri, Feb 22, 2019 at 05:04:12PM +0100, Juerg Haefliger wrote:
>  libfdisk/src/dos.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-25 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 16:04 [PATCH] libfdisk: (dos) Use strtoul to parse the label-id Juerg Haefliger
2019-02-25 13:09 ` Karel Zak

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).