Util-Linux Archive on lore.kernel.org
 help / color / 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	[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, back to index

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

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox