Kaydet (Commit) 933d3731 authored tarafından Gregory P. Smith's avatar Gregory P. Smith

Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is

passed in.  (The assert won't prevent this in non-debug builds).
üst c1c83bb0
......@@ -98,7 +98,8 @@ PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va)
PyMem_FREE(buffer);
#endif
Done:
str[size-1] = '\0';
if (size > 0)
str[size-1] = '\0';
return len;
#undef _PyOS_vsnprintf_EXTRA_SPACE
}
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