Avoid confusing "read prevented write" log messages.

Moving to a "function: message" style avoids ambiguity.

Change-Id: If9d590e50265c61725d3673bd03796e65edd2d5e
This commit is contained in:
Elliott Hughes
2013-10-15 16:43:38 -07:00
parent dc9d8d050a
commit d1eda33f01
22 changed files with 187 additions and 237 deletions

View File

@@ -42,19 +42,13 @@
* This vsnprintf check is called if _FORTIFY_SOURCE is defined and
* greater than 0.
*/
extern "C" int __vsnprintf_chk(
char *dest,
size_t supplied_size,
int /*flags*/,
size_t dest_len_from_compiler,
const char *format,
va_list va)
{
if (__predict_false(supplied_size > dest_len_from_compiler)) {
__fortify_chk_fail("vsnprintf prevented write past end of buffer", 0);
}
extern "C" int __vsnprintf_chk(char* dest, size_t supplied_size, int /*flags*/,
size_t dest_len_from_compiler, const char* format, va_list va) {
if (__predict_false(supplied_size > dest_len_from_compiler)) {
__fortify_chk_fail("vsnprintf: prevented write past end of buffer", 0);
}
return vsnprintf(dest, supplied_size, format, va);
return vsnprintf(dest, supplied_size, format, va);
}
/*
@@ -68,20 +62,11 @@ extern "C" int __vsnprintf_chk(
* This snprintf check is called if _FORTIFY_SOURCE is defined and
* greater than 0.
*/
extern "C" int __snprintf_chk(
char *dest,
size_t supplied_size,
int flags,
size_t dest_len_from_compiler,
const char *format, ...)
{
va_list va;
int retval;
va_start(va, format);
retval = __vsnprintf_chk(dest, supplied_size, flags,
dest_len_from_compiler, format, va);
va_end(va);
return retval;
extern "C" int __snprintf_chk(char* dest, size_t supplied_size, int flags,
size_t dest_len_from_compiler, const char* format, ...) {
va_list va;
va_start(va, format);
int result = __vsnprintf_chk(dest, supplied_size, flags, dest_len_from_compiler, format, va);
va_end(va);
return result;
}