Browse Source

dbus: Restrict DeviceName size to 32 characters in setter

The maximum WPS Device Name length is 32 characters and that limit was
already enforced for the control interface and configuration files.

Signed-off-by: Purushottam Kushwaha <p.kushwaha@samsung.com>
Purushottam Kushwaha 9 years ago
parent
commit
bcce934755
1 changed files with 2 additions and 1 deletions
  1. 2 1
      wpa_supplicant/dbus/dbus_new_handlers_p2p.c

+ 2 - 1
wpa_supplicant/dbus/dbus_new_handlers_p2p.c

@@ -945,7 +945,8 @@ dbus_bool_t wpas_dbus_setter_p2p_device_config(
 		if (os_strcmp(entry.key, "DeviceName") == 0) {
 			char *devname;
 
-			if (entry.type != DBUS_TYPE_STRING)
+			if (entry.type != DBUS_TYPE_STRING ||
+			    os_strlen(entry.str_value) > WPS_DEV_NAME_MAX_LEN)
 				goto error;
 
 			devname = os_strdup(entry.str_value);