mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-16 09:01:12 +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+ssh://svn.code.sf.net/p/quakespasm/code/trunk@563 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
5fe1cd97dc
commit
fadfa30b3f
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