From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17626 invoked by alias); 8 Dec 2005 13:34:05 -0000 Received: (qmail 17618 invoked by uid 48); 8 Dec 2005 13:34:04 -0000 Date: Thu, 08 Dec 2005 13:34:00 -0000 From: "michael dot kerrisk at gmx dot net" To: glibc-bugs@sources.redhat.com Message-ID: <20051208133403.1995.michael.kerrisk@gmx.net> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/1995] New: fprintf() + fmemopen() error (?) X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2005-12/txt/msg00044.txt.bz2 List-Id: 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 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.