Kaydet (Commit) aa6111fc authored tarafından Tim Peters's avatar Tim Peters

Add mysnprintf.c to Windows build, + squash compiler wngs in mysnprintf.c.

üst 03d1b181
...@@ -1163,6 +1163,21 @@ SOURCE=..\Parser\myreadline.c ...@@ -1163,6 +1163,21 @@ SOURCE=..\Parser\myreadline.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\Python\mysnprintf.c
!IF "$(CFG)" == "pythoncore - Win32 Release"
!ELSEIF "$(CFG)" == "pythoncore - Win32 Debug"
!ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug"
!ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\Python\mystrtoul.c SOURCE=..\Python\mystrtoul.c
!IF "$(CFG)" == "pythoncore - Win32 Release" !IF "$(CFG)" == "pythoncore - Win32 Release"
......
...@@ -37,9 +37,10 @@ int myvsnprintf(char *str, size_t size, const char *format, va_list va) ...@@ -37,9 +37,10 @@ int myvsnprintf(char *str, size_t size, const char *format, va_list va)
return len; return len;
} }
len++; len++;
if (len > size + 512) assert(len >= 0);
if ((size_t)len > size + 512)
Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf"); Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf");
if (len > size) { if ((size_t)len > size) {
PyMem_Free(buffer); PyMem_Free(buffer);
return len - 1; return len - 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment