mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
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).
This commit is contained in:
parent
c1c83bb0de
commit
933d3731de
1 changed files with 2 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue