public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "michael dot kerrisk at gmx dot net" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/1995] New: fprintf() + fmemopen() error (?) Date: Thu, 08 Dec 2005 13:34:00 -0000 [thread overview] Message-ID: <20051208133403.1995.michael.kerrisk@gmx.net> (raw) When run, the program below displays the following output: $ ./a.out ret = 19 buf=123456789 However, since the fprintf() is causing an overflow in 'buf' shouldn't the call be returning -1 as an error indication (as would happen when fprintf() fails because the disk is full)? Cheers, Michael define _GNU_SOURCE #include <stdio.h> int main() { char buf[10]; FILE *fp; int ret; fp = fmemopen(buf, sizeof(buf), "w"); ret = fprintf(fp, "%s", "1234567890123456789"); fclose(fp); printf("ret = %d buf=%s\n", ret, buf); return 0; } -- Summary: fprintf() + fmemopen() error (?) Product: glibc Version: 2.3.5 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: michael dot kerrisk at gmx dot net CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=1995 ------- 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:[~2005-12-08 13:34 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-12-08 13:34 michael dot kerrisk at gmx dot net [this message] 2006-03-31 18:56 ` [Bug libc/1995] " rsa at us dot ibm dot com 2006-04-11 22:49 ` rsa at us dot ibm dot com 2006-04-12 22:20 ` rsa at us dot ibm dot com 2006-04-19 2:14 ` michael dot kerrisk at gmx dot net 2006-04-19 12:18 ` tschwinge at gnu dot org 2006-04-19 19:52 ` michael dot kerrisk at gmx dot net 2006-04-19 20:05 ` rsa at us dot ibm dot com 2006-04-19 21:00 ` michael dot kerrisk at gmx dot net 2006-04-19 21:41 ` rsa at us dot ibm dot com 2006-04-19 23:24 ` michael dot kerrisk at gmx dot net 2006-04-20 15:35 ` rsa at us dot ibm dot com 2006-04-20 19:33 ` michael dot kerrisk at gmx dot net 2006-04-21 13:03 ` rsa at us dot ibm dot com 2006-04-23 17:03 ` drepper at redhat dot com 2006-04-24 15:20 ` rsa at us dot ibm 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=20051208133403.1995.michael.kerrisk@gmx.net \ --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).