🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #923

Re: bug in sscanf (scanf)?

#923
From: Nicholas J. Simicich;?
Date: Thu, 17 Nov 1988 23:40
16 lines
1221 bytes
In article <331@zeus.hf.intel.com> martin@zeus.hf.intel.com (Martin Wilde) writes:
>  I have a small fragment of code that does not work on V.3.2 386 UNIX. 
>  The problem appears to be in sscanf (scanf).   The following fragment of
>  code shows the problem.
 .....
>  	(void) sscanf(optarg, "%d %s %s %s %255[^\0]", &times, s1, s2, s3, s4);

The bug is actually in the representation of a string in C, of course
(no flames please).   The format string is being passed to sscanf as:

"%d %s %s %s %255[^"

Since the \0 is an end of string character.  So sscanf can't interpret
what you intended.
--
Nick Simicich --- uunet!bywater!scifi!njs --- njs@ibm.com (Internet)
Technical Details
Message-ID: <NJS.88Nov17184006@scifi.scifi.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!bywater!acheron!scifi!njs
References: <331@zeus.hf.intel.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!bywater!acheron!scifi!njs
From: njs@scifi.scifi.UUCP (Nicholas J. Simicich;?)
Newsgroups: comp.bugs.sys5
Subject: Re: bug in sscanf (scanf)?
Message-ID: <NJS.88Nov17184006@scifi.scifi.UUCP>
Date: 17 Nov 88 23:40:06 GMT
References: <331@zeus.hf.intel.com>
Sender: njs@scifi.UUCP
Organization: Nick Simicich, Peekskill, NY
Lines: 16
In-reply-to: martin@zeus.hf.intel.com's message of 16 Nov 88 18:51:56 GMT