Re: Recommending UB in fmemopen man page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Rich,

On 10 August 2016 at 03:13, Rich Felker <dalias@xxxxxxxx> wrote:
> This recent Stack Overflow question turned up a recommendaton to
> invoke undefined behavior in the fmemopen man page:
>
> http://stackoverflow.com/questions/38854163/using-rewind-on-a-file-opened-with-fmemopen
>
> The stdio buffer associated with the fmemopen-obtained FILE, and the
> output memory buffer into which it's writing, are conceptually
> distinct entities, and there is no reason to expect reasonable results
> if you modify the contents of a setvbuf-associated buffer through
> other means while it's associated with a FILE.
>
> The following text should simply be removed:
>
>        Alternatively, the caller can explicitly set buf as the stdio
>        stream buffer, at the same time informing stdio of the buffer's
>        size, using:
>
>            setbuffer(stream, buf, size);

A discussion at the time [1] that that text was added made it seem
reasonable, but you've convinced me otherwise. Text removed. Thanks
for the report.

Cheers,

Michael

[1] http://sourceware.org/bugzilla/show_bug.cgi?id=1995 and
http://sources.redhat.com/ml/libc-alpha/2006-04/msg00064.html

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux