config: Reject invalid SSID hexadecimal entries
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Mon, 14 May 2012 12:20:44 +0000 (15:20 +0300)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 15 May 2012 12:52:07 +0000 (15:52 +0300)
Reject provisioning .config file SSID entries that are not in
hexadecimal.

src/config.c

index 781427d..66e1316 100644 (file)
@@ -258,7 +258,13 @@ static int load_service(GKeyFile *keyfile, const char *group,
                }
 
                for (i = 0; i < hex_ssid_len; i += 2) {
-                       sscanf(hex_ssid + i, "%02x", &hex);
+                       if (sscanf(hex_ssid + i, "%02x", &hex) <= 0) {
+                               connman_warn("Invalid SSID %s", hex_ssid);
+                               g_free(ssid);
+                               g_free(hex_ssid);
+                               err = -EILSEQ;
+                               goto err;
+                       }
                        ssid[j++] = hex;
                }