Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2000 15:45:42 -0700 (PDT)
From:      Jin Guojun (DSD staff) <jin@iss-p10.lbl.gov>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/19994: sscanf() fails on 64-bit operations
Message-ID:  <200007172245.PAA00517@iss-p10.lbl.gov>

next in thread | raw e-mail | index | archive | help

>Number:         19994
>Category:       misc
>Synopsis:       sscanf() fails on 64-bit operations
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 17 15:50:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jin Guojun (DSD staff)
>Release:        FreeBSD 4.0-20000627-STABLE i386
>Organization:
>Environment:

	FreeBSD all releases

>Description:

	sscanf(), and maybe scanf ..., fails on 64-bit operation.

	On Solaris, IRIX and Linux systems, the code below outputs:

	% hextodec -r 963870220966261
	0x00036CA286215975

	% hextodec 0x00036CA286215975
	963870220966261

	% hextodec 0x2804C6B886215975
	2883648157250574709


	Under FreeBSD
 	% hextodec -r 963870220966261
	0x2804C6B886215975

	% hextodec 0x00036CA286215975
	2883648157250574709

	% hextodec 0x2804C6B886215975	# this seems correct
	2883648157250574709


>How-To-Repeat:

	main(argc, argv)
	{
	int rev, i = 1;
		if (!strcmp(argv[i], "-r"))	{
			rev = 1;
			i++;
		} else	rev = 0;
	{
        int64_t h;
                rev ? sscanf(argv[i], "%lld", &h) : sscanf(argv[i], "%llx", &h);
                printf(rev ? "0x%016llX\n": "%lld\n", h);
        }
	}

>Fix:

	


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007172245.PAA00517>