strace: vsnprintf returns total possible characters, not number written.

Thus we have to clamp it. Fixes crashes with very long syscall arguments.
This commit is contained in:
Augustin Cavalier
2024-07-16 18:43:50 -04:00
parent 6c4e414fe6
commit 0fbd5c96af
+3
View File
@@ -323,6 +323,9 @@ print_to_string(char **_buffer, int32 *_length, const char *format, ...)
ssize_t length = vsnprintf(*_buffer, *_length, format, list);
va_end(list);
if (length > *_length)
length = *_length;
*_buffer += length;
*_length -= length;
}