Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2000 16:50:07 -0700 (PDT)
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: misc/19994: sscanf() fails on 64-bit operations
Message-ID:  <200007172350.QAA80903@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/19994; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: j_guojun@lbl.gov
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/19994: sscanf() fails on 64-bit operations
Date: Tue, 18 Jul 2000 09:41:10 +1000 (EST)

 On Mon, 17 Jul 2000, Jin Guojun wrote:
 
 > >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);
 >         }
 > 	}
 
 64-bit types are unportable.  FreeBSD's scanf only supports reading "quad"
 types using %qd format.
 
 FreeBSD's scanf also has some overflow handling bugs from misusing strtoq
 to handle non-quads.
 
 Bruce
 
 Bruce
 
 


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?200007172350.QAA80903>