Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2eaa12d authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 9661

* changes:
  wifi: Strip trailing spaces before parsing RSSI results.
parents 3dcca705 b20148b8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -324,6 +324,13 @@ static jint android_net_wifi_getRssiHelper(const char *cmd)
    // number we're interested in.  if we're associating, it returns "OK".
    // beware - <SSID> can contain spaces.
    if (strcmp(reply, "OK") != 0) {
        // beware of trailing spaces
        char* end = reply + strlen(reply);
        while (end > reply && end[-1] == ' ') {
            end--;
        }
        *end = 0;

        char* lastSpace = strrchr(reply, ' ');
        // lastSpace should be preceded by "rssi" and followed by the value
        if (lastSpace && !strncmp(lastSpace - 4, "rssi", 4)) {