aboutsummaryrefslogtreecommitdiffstats
path: root/libc/bionic/__vsnprintf_chk.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-15 16:43:38 -0700
committerElliott Hughes <enh@google.com>2013-10-15 16:49:28 -0700
commitd1eda33f012e46083b91e087fb79d14a5ce70f0e (patch)
tree2d075e9d43c3a300327e79ee27c5b8330d8dce4c /libc/bionic/__vsnprintf_chk.cpp
parentdc9d8d050a43e1cd32f1337e79187124bb15d938 (diff)
downloadandroid_bionic-d1eda33f012e46083b91e087fb79d14a5ce70f0e.tar.gz
android_bionic-d1eda33f012e46083b91e087fb79d14a5ce70f0e.tar.bz2
android_bionic-d1eda33f012e46083b91e087fb79d14a5ce70f0e.zip
Avoid confusing "read prevented write" log messages.
Moving to a "function: message" style avoids ambiguity. Change-Id: If9d590e50265c61725d3673bd03796e65edd2d5e
Diffstat (limited to 'libc/bionic/__vsnprintf_chk.cpp')
-rw-r--r--libc/bionic/__vsnprintf_chk.cpp41
1 files changed, 13 insertions, 28 deletions
diff --git a/libc/bionic/__vsnprintf_chk.cpp b/libc/bionic/__vsnprintf_chk.cpp
index a03d12fb6..ecf58168b 100644
--- a/libc/bionic/__vsnprintf_chk.cpp
+++ b/libc/bionic/__vsnprintf_chk.cpp
@@ -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;
}