mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Rework change to util::vfmt to fix strings getting truncated
This commit is contained in:
parent
77c555a3a8
commit
78fb845f63
1 changed files with 3 additions and 3 deletions
|
@ -1620,11 +1620,11 @@ const char* vfmt(const char* format, va_list al)
|
|||
va_copy(alc, al);
|
||||
int n = vsnprintf(buf, buf_len, format, al);
|
||||
|
||||
if ( n < 0 && buf_len < 1024 * 1024 )
|
||||
if ( n > 0 && buf_len < n )
|
||||
{ // Not enough room, grow the buffer.
|
||||
buf_len += 32;
|
||||
buf_len = n + 32;
|
||||
buf = (char*)safe_realloc(buf, buf_len);
|
||||
n = vsnprintf(buf, buf_len, format, al);
|
||||
n = vsnprintf(buf, buf_len, format, alc);
|
||||
}
|
||||
|
||||
if ( n < 0 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue