aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wps_supplicant.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-12-07 10:15:34 (GMT)
committerJouni Malinen <j@w1.fi>2014-12-08 09:42:07 (GMT)
commita80ba67a26f51d61fc5875a22912c1316f1e1536 (patch)
tree1c5a113da32fe89ce7b1764dcfd245d9da81e867 /wpa_supplicant/wps_supplicant.c
parenta9aaacbb5081f41318ddb0fa597da6c29c6898df (diff)
downloadhostap-a80ba67a26f51d61fc5875a22912c1316f1e1536.zip
hostap-a80ba67a26f51d61fc5875a22912c1316f1e1536.tar.gz
hostap-a80ba67a26f51d61fc5875a22912c1316f1e1536.tar.bz2
Check os_snprintf() result more consistently - success case
This converts os_snprintf() result validation cases to use os_snprintf_error() in cases where success condition was used to execute a step. These changes were done automatically with spatch using the following semantic patch: @@ expression E1,E2,E3; statement S1; @@ E1 = os_snprintf(E2, E3, ...); - if (\( E1 >= 0 \| E1 > 0 \) && \( (size_t) E1 < E3 \| E1 < (int) E3 \| E1 < E3 \)) + if (!os_snprintf_error(E3, E1)) S1 Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/wps_supplicant.c')
-rw-r--r--wpa_supplicant/wps_supplicant.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index d934b1a..94064df 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1318,7 +1318,7 @@ static void wpas_wps_pin_needed_cb(void *ctx, const u8 *uuid_e,
dev->model_number, dev->serial_number,
wps_dev_type_bin2str(dev->pri_dev_type, devtype,
sizeof(devtype)));
- if (len > 0 && len < (int) sizeof(txt))
+ if (!os_snprintf_error(sizeof(txt), len))
wpa_printf(MSG_INFO, "%s", txt);
}