Date: Mon, 17 Jul 2000 18:20:04 -0700 (PDT) From: Jin Guojun (DSD staff) <jin@george.lbl.gov> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/19994: sscanf() fails on 64-bit operations Message-ID: <200007180120.SAA92004@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: Jin Guojun (DSD staff) <jin@george.lbl.gov>
To: bde@zeta.org.au, j_guojun@lbl.gov
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/19994: sscanf() fails on 64-bit operations
Date: Mon, 17 Jul 2000 18:09:50 -0700 (PDT)
On Mon, 17 Jul 2000, Bruce Evans <bde@zeta.org.au> 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.
Shall we have "%lld" in FreeBSD to make it portable with other systems?
-Jin
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?200007180120.SAA92004>
