[llvm-commits] [llvm] r141093 - /llvm/trunk/lib/TableGen/TGPreprocessor.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Oct 4 10:03:06 PDT 2011


On Oct 4, 2011, at 9:28 AM, Francois Pichet wrote:

> Author: fpichet
> Date: Tue Oct  4 11:28:07 2011
> New Revision: 141093
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=141093&view=rev
> Log:
> Unbreak MSVC build.
> 
> Modified:
>    llvm/trunk/lib/TableGen/TGPreprocessor.cpp
> 
> Modified: llvm/trunk/lib/TableGen/TGPreprocessor.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGPreprocessor.cpp?rev=141093&r1=141092&r2=141093&view=diff
> ==============================================================================
> --- llvm/trunk/lib/TableGen/TGPreprocessor.cpp (original)
> +++ llvm/trunk/lib/TableGen/TGPreprocessor.cpp Tue Oct  4 11:28:07 2011
> @@ -24,6 +24,10 @@
> #include <cstdlib>
> #include <cstring>
> 
> +#ifdef _MSC_VER
> +#define snprintf _snprintf
> +#endif

Hi Francois,

Unfortunately, Microsoft's _snprintf is not a safe replacement for the C99 snprintf function. It doesn't NUL-terminate the buffer on overflow.

Please rewrite the code to use raw_string_ostream, or plain sprintf which seems safe in this case.

/jakob




More information about the llvm-commits mailing list