[cfe-dev] sprintf -> snprintf conversion

Douglas Gregor dgregor at apple.com
Mon Nov 8 19:22:06 PST 2010


On Oct 25, 2010, at 12:34 PM, Vladimir Kirillov wrote:

> On 10:27 Mon 25 Oct, Eli Friedman wrote:
>> On Mon, Oct 25, 2010 at 1:00 AM, Vladimir Kirillov <proger at uaoug.org.ua> wrote:
>>> Hello, cfe-dev!
>>> 
>>> I'm using LLVM/Clang on OpenBSD. This project proactively advocates
>>> usage of 'secure' C apis, especially related to memory bounds
>>> checking. Thus using functions like sprintf/strcpy/etc usually spits
>>> out a linker warning in base toolchain:
>>> 
>>> /home/proger/dev/llvm/Debug+Asserts/lib/libclangFrontend.a(DocumentXML.o)(.text+0xc65): In function `clang::DocumentXML::escapeString(char const*, unsigned long)':
>>> /home/proger/dev/llvm/tools/clang/lib/Frontend/DocumentXML.cpp:107: warning: sprintf() is often misused, please use snprintf()
>>> 
>>> I've done some conversions from sprintf to snprintf, please commit those.
>>> 
>>> Thanks!
>> 
>> Please send that patch to llvmdev, since it doesn't appear to touch
>> any clang-specific code.
>> 
>> -Eli
> 
> Actually, it does. I'm reattaching the diff without the llvm bits.
> However, thanks for your hint, I'll do it in a moment.

Thanks, committed as r118478.

	- Doug





More information about the cfe-dev mailing list