From 1a5b6098d5002ae07ce3f9bc514400a87c2b64fa Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Wed, 4 May 2011 14:16:44 -0700 Subject: Handle GET_POWER failures Return a failure when GET_POWER returns a non-conforming format Bug: 4380317 Change-Id: If1ce73572ae261cd6998e4289e21112c88859437 --- core/jni/android_net_wifi_Wifi.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index fb029e6e1713..35d8dc3eea5e 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -402,7 +402,9 @@ static jint android_net_wifi_getPowerModeCommand(JNIEnv* env, jobject clazz) } // reply comes back in the form "powermode = XX" where XX is the // number we're interested in. - sscanf(reply, "%*s = %u", &power); + if (sscanf(reply, "%*s = %u", &power) != 1) { + return (jint)-1; + } return (jint)power; } -- cgit v1.2.3-59-g8ed1b