Fix buffer overflow in test_printf (fixes #1)
This commit is contained in:
@@ -31,6 +31,10 @@ void test_printf(char *fmt, ...)
|
|||||||
sizeof(test_output_buffer) - test_output_buffer_used,
|
sizeof(test_output_buffer) - test_output_buffer_used,
|
||||||
fmt, args);
|
fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
|
assert(len > -1);
|
||||||
|
if (len > (int) sizeof(test_output_buffer) - test_output_buffer_used)
|
||||||
|
len = sizeof(test_output_buffer) - test_output_buffer_used;
|
||||||
test_output_buffer_used += len;
|
test_output_buffer_used += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user