public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "michael dot yacc at blueyonder dot co dot uk" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/11595] New: sprintf %% format error resulting in output corruption Date: Thu, 13 May 2010 11:40:00 -0000 [thread overview] Message-ID: <20100513114042.11595.michael.yacc@blueyonder.co.uk> (raw) The following program produces different output for printf and sprintf. It appears the sprintf is being corrupted by the %% in the format string #include <cstdio> int main(int ac, char **av) { char buf[1024]; printf("%8.4f%% AAAA\n", 98.3450); sprintf(buf, "%8.4f%% AAAA\n", 98.3450); printf(buf); return (0); } The output on my server (Linux analysis-043 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux) is 98.3450% AAAA 98.3450 0X1.896147AE147AEP+6AAA I think the output should be identical. When %% is present in the sprintf format string the output is being corrupted. -- Summary: sprintf %% format error resulting in output corruption Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: michael dot yacc at blueyonder dot co dot uk CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=11595 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next reply other threads:[~2010-05-13 11:40 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-05-13 11:40 michael dot yacc at blueyonder dot co dot uk [this message] 2010-05-13 11:46 ` [Bug libc/11595] " jakub at redhat dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100513114042.11595.michael.yacc@blueyonder.co.uk \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).