summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kenny Root <kroot@google.com> 2010-02-16 12:03:50 -0800
committer Kenny Root <kroot@google.com> 2010-02-16 12:16:48 -0800
commit412dc7de6ed15221d8ed63c664f5585b0fd853bd (patch)
tree1ed17e56be9c2a0881095592da8e7fe9061013a8
parent3619b9abd8470f83ae49bb0e364e67bec9323f5b (diff)
Fix off-by-one in parse3339 timezone check
parse3339 could read past the end of a string if the timezone was truncated by one character causing intermittent failures in unit tests. Change-Id: I7e1724c6a7b464fdcb5e2b37469eb128303a51f1
-rw-r--r--core/jni/android_text_format_Time.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/jni/android_text_format_Time.cpp b/core/jni/android_text_format_Time.cpp
index d89a7e68a9fd..c152aa8351af 100644
--- a/core/jni/android_text_format_Time.cpp
+++ b/core/jni/android_text_format_Time.cpp
@@ -584,9 +584,9 @@ static jboolean android_text_format_Time_parse3339(JNIEnv* env,
inUtc = true;
if (offset != 0) {
- if (len < tz_index + 5) {
+ if (len < tz_index + 6) {
char msg[100];
- sprintf(msg, "Unexpected length; should be %d characters", tz_index + 5);
+ sprintf(msg, "Unexpected length; should be %d characters", tz_index + 6);
jniThrowException(env, "android/util/TimeFormatException", msg);
return false;
}