diff options
| author | 2011-05-04 14:16:44 -0700 | |
|---|---|---|
| committer | 2011-05-06 15:06:30 -0700 | |
| commit | c351f52a4a40155444e956824dd738d7a41678d9 (patch) | |
| tree | a38bc7288d3d7df3dc03f611e0e07bd75fa8bad8 | |
| parent | a8f6a0d90cd4aee6dd148b23598eb8c8cafdf53c (diff) | |
DO NOT MERGE Handle GET_POWER failures
Return a failure when GET_POWER returns a non-conforming
format
Bug: 4380317
Change-Id: Ie723c424ab07774f2be2594aa5deeaa5cd5ac280
| -rw-r--r-- | core/jni/android_net_wifi_Wifi.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index 667ba75ebd46..4e363bfa8b14 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -459,7 +459,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; } |