Message ID | CAFk-A4mWbDwLUW_wovRrpKcXENNoCTiYjsMrjGDgwnY2wUPn9Q@mail.gmail.com |
---|---|
State | Accepted |
Headers | show |
On Tue, Mar 06, 2012 at 08:49:58PM +0900, Masashi Honma wrote: > Thanks for your advice. I relaxed the restriction of new patch. Thanks, applied. > diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c > @@ -2750,6 +2752,13 @@ static int p2p_ctrl_connect(struct > + val = strtol(pin, &end, 10); > + val = val; // workaround for a compiler warning > + if ((os_strlen(pin) != 4 && os_strlen(pin) != 8) || > + *end != '\0') { Though, I replaced that val = val; workaround with val < 0 check to avoid accepting values like "-123" as a valid PIN. This would still accept "+123".. I ended up moving this to a common WPS function and implementing the validation with a loop that verifies that each character is a digit to avoid that type of corner cases.
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 11f4674..f98d403 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2696,6 +2696,7 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd, u8 addr[ETH_ALEN]; char *pos, *pos2; char *pin = NULL; + char *end; enum p2p_wps_method wps_method; int new_pin;