[LLVMdev] sprintf -> snprintf conversion
Jakob Stoklund Olesen
stoklund at 2pi.dk
Mon Oct 25 15:18:07 PDT 2010
On Oct 25, 2010, at 10:37 AM, Vladimir Kirillov wrote:
> Hello, llvmdev!
>
> I'm using LLVM 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 like this one:
>
> /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()
We really should "warning: C is often misused, please use Java".
Does this compile on Windows? I don't think Microsoft has gotten around to providing a snprintf() yet, see Format.h.
/jakob
More information about the llvm-dev
mailing list