summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThe Android Open Source Project2010-03-08 19:14:43 -0600
committerThe Android Open Source Project2010-03-08 19:14:43 -0600
commit7df6349a63b89d279131ec7dd7e6ef1b065854f5 (patch)
tree030b554cb95806d7da5eb72d17436de70f686b63
parentb51cb880c02836a57426620f40a1ba9331b6c52a (diff)
parentfd7ebb367330ea3b999ca9c2a48431c437c05f67 (diff)
downloadplatform-system-core-7df6349a63b89d279131ec7dd7e6ef1b065854f5.tar.gz
platform-system-core-7df6349a63b89d279131ec7dd7e6ef1b065854f5.tar.xz
platform-system-core-7df6349a63b89d279131ec7dd7e6ef1b065854f5.zip
merge from open-source master
Change-Id: I698b3c16bdef8751cc857b00f815cb2f95465431
-rw-r--r--liblog/logprint.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/liblog/logprint.c b/liblog/logprint.c
index 5ddda3626..4c5b3e578 100644
--- a/liblog/logprint.c
+++ b/liblog/logprint.c
@@ -753,6 +753,16 @@ char *android_log_formatLogLine (
753 suffixLen = 1; 753 suffixLen = 1;
754 break; 754 break;
755 } 755 }
756 /* snprintf has a weird return value. It returns what would have been
757 * written given a large enough buffer. In the case that the prefix is
758 * longer then our buffer(128), it messes up the calculations below
759 * possibly causing heap corruption. To avoid this we double check and
760 * set the length at the maximum (size minus null byte)
761 */
762 if(prefixLen >= sizeof(prefixBuf))
763 prefixLen = sizeof(prefixBuf) - 1;
764 if(suffixLen >= sizeof(suffixBuf))
765 suffixLen = sizeof(suffixBuf) - 1;
756 766
757 /* the following code is tragically unreadable */ 767 /* the following code is tragically unreadable */
758 768