aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ap.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-12-07 13:45:02 (GMT)
committerJouni Malinen <j@w1.fi>2014-12-08 09:42:07 (GMT)
commitaaadd72733fe5099bf0849ade5890ff119e38091 (patch)
treea0433bdea8e22b9949fb0190ed5eae8520ed06a5 /wpa_supplicant/ap.c
parent1d399771367e6c26927141ca3bca19ba53584cbb (diff)
downloadhostap-aaadd72733fe5099bf0849ade5890ff119e38091.zip
hostap-aaadd72733fe5099bf0849ade5890ff119e38091.tar.gz
hostap-aaadd72733fe5099bf0849ade5890ff119e38091.tar.bz2
Check os_snprintf() result more consistently - more checks
Add more os_snprintf() result validation checks. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/ap.c')
-rw-r--r--wpa_supplicant/ap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 0e6769b..8c3d3b8 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -812,9 +812,14 @@ int wpa_supplicant_ap_wps_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
if (pin == NULL) {
unsigned int rpin = wps_generate_pin();
ret_len = os_snprintf(buf, buflen, "%08d", rpin);
+ if (os_snprintf_error(buflen, ret_len))
+ return -1;
pin = buf;
- } else
+ } else if (buf) {
ret_len = os_snprintf(buf, buflen, "%s", pin);
+ if (os_snprintf_error(buflen, ret_len))
+ return -1;
+ }
ret = hostapd_wps_add_pin(wpa_s->ap_iface->bss[0], bssid, "any", pin,
timeout);