mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
common.c (q_vsnprintf): Don't attempt to nul terminate the buffer
if zero size was passed. From Sander van Dijk. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@563 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
533ae210a4
commit
d0093d0b80
1 changed files with 2 additions and 1 deletions
|
@ -154,7 +154,8 @@ int q_vsnprintf(char *str, size_t size, const char *format, va_list args)
|
|||
|
||||
if (ret < 0)
|
||||
ret = (int)size;
|
||||
|
||||
if (size == 0) /* no buffer */
|
||||
return ret;
|
||||
if ((size_t)ret >= size)
|
||||
str[size - 1] = '\0';
|
||||
|
||||
|
|
Loading…
Reference in a new issue