public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/8194: sprintf causes segfaults
@ 2002-10-10 17:16 finch
0 siblings, 0 replies; 2+ messages in thread
From: finch @ 2002-10-10 17:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 8194
>Category: c
>Synopsis: sprintf causes segfaults
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Oct 10 17:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Gabriel Finch
>Release: unknown-1.0
>Organization:
>Environment:
gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk)
>Description:
The following code causes a segfault on exit when compiled with gcc and run:
#include <stdio.h>
int main() {
char *i,*s;
sprintf(s,"%s","a"); // any format string works here
sprintf(i,"xx%s",s); // must be 2 or more chars before %s
return 0;
}
>How-To-Repeat:
Compile above code with gcc and execute it.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c/8194: sprintf causes segfaults
@ 2002-10-10 17:21 pme
0 siblings, 0 replies; 2+ messages in thread
From: pme @ 2002-10-10 17:21 UTC (permalink / raw)
To: finch, gcc-bugs, gcc-prs, nobody
Synopsis: sprintf causes segfaults
State-Changed-From-To: open->closed
State-Changed-By: pme
State-Changed-When: Thu Oct 10 17:21:16 2002
State-Changed-Why:
This has nothing to do with the compiler. You must
allocate space before attempting to write to it with
sprintf (or anything else).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8194
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-10-11 0:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-10 17:16 c/8194: sprintf causes segfaults finch
2002-10-10 17:21 pme
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).