Re: [PATCH] printf.3: Add a note about sprintf(s, "%s", s)

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

 



On Fri, Dec 19, 2008 at 12:37 PM, Petr Baudis <pasky@xxxxxxx> wrote:
>  Hi,
>
> On Fri, Dec 19, 2008 at 11:57:05AM -0500, Michael Kerrisk wrote:
>> I agree that there's a problem with the page, but I don't think this
>> patch is sufficient, nor does is it made in quite the right place.
>> (This isn't a point that relates specifically to "%s", but rather to
>> the *s*printf() functions.)
>>
>> I made a much bigger change that goes into more detail.  The patch,
>> destined for 3.16, is shown below.  Does it look okay to you?
>
>  I agree that it is better. Just out of curiosity, can you think of any
> other conversions than %s that would cause this? Maybe I missed
> something obvious but I could not think of anything.

Offhand, %s is the only obvious one.  But, hey, someone could try
weird trickery with other pointers (e.g., interpret some part of the
destination buffer as a pointer to int), so I imagine that is why we
have the looser wording in the standards.

Cheers,

Michael

> --
>                                Petr "Pasky" Baudis
> The average, healthy, well-adjusted adult gets up at seven-thirty
> in the morning feeling just terrible. -- Jean Kerr
>



-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html
Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html
--
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