public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/1995] New: fprintf() + fmemopen() error (?)
@ 2005-12-08 13:34 michael dot kerrisk at gmx dot net
  2006-03-31 18:56 ` [Bug libc/1995] " rsa at us dot ibm dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 17+ messages in thread
From: michael dot kerrisk at gmx dot net @ 2005-12-08 13:34 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 17+ messages in thread
[parent not found: <bug-1995-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2012-04-28  2:31 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-08 13:34 [Bug libc/1995] New: fprintf() + fmemopen() error (?) michael dot kerrisk at gmx dot net
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
     [not found] <bug-1995-131@http.sourceware.org/bugzilla/>
2012-04-28  2:31 ` mtk.manpages at gmail dot com

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).