diff options
| author | 2011-05-04 14:16:44 -0700 | |
|---|---|---|
| committer | 2011-05-04 14:23:42 -0700 | |
| commit | 1a5b6098d5002ae07ce3f9bc514400a87c2b64fa (patch) | |
| tree | 86b84a16f4872fe4ee63f1d05f6439ac2db591db | |
| parent | 4ec33c2aad59b2a745ee891c9b7246b9533d95e0 (diff) | |
Handle GET_POWER failures
Return a failure when GET_POWER returns a non-conforming
format
Bug: 4380317
Change-Id: If1ce73572ae261cd6998e4289e21112c88859437
| -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 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;  }  |