Browse Source

WPS: Use strdup to initialize dev_password for PBC

Some static analyzers complain about memset with '0' value. This was
used correctly here, but since use of strdup is about as good an option,
use that to silence the invalid warnings.

Signed-hostap: Jouni Malinen <j@w1.fi>
Jouni Malinen 13 years ago
parent
commit
68a0f6d768
1 changed files with 1 additions and 2 deletions
  1. 1 2
      src/wps/wps.c

+ 1 - 2
src/wps/wps.c

@@ -67,12 +67,11 @@ struct wps_data * wps_init(const struct wps_config *cfg)
 		/* Use special PIN '00000000' for PBC */
 		/* Use special PIN '00000000' for PBC */
 		data->dev_pw_id = DEV_PW_PUSHBUTTON;
 		data->dev_pw_id = DEV_PW_PUSHBUTTON;
 		os_free(data->dev_password);
 		os_free(data->dev_password);
-		data->dev_password = os_malloc(8);
+		data->dev_password = (u8 *) os_strdup("00000000");
 		if (data->dev_password == NULL) {
 		if (data->dev_password == NULL) {
 			os_free(data);
 			os_free(data);
 			return NULL;
 			return NULL;
 		}
 		}
-		os_memset(data->dev_password, '0', 8);
 		data->dev_password_len = 8;
 		data->dev_password_len = 8;
 	}
 	}