[PATCH 2/3] hs20-osu-client: Check length of language code
Cedric Izoard
Cedric.Izoard at ceva-dsp.com
Tue Jun 14 05:49:44 PDT 2016
Compute the actual language code length and don't assume
it is 3 characters long
Signed-off-by: Cedric Izoard <cedric.izoard at ceva-dsp.com>
---
hs20/client/osu_client.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/hs20/client/osu_client.c b/hs20/client/osu_client.c
index c05c57d..deb1301 100644
--- a/hs20/client/osu_client.c
+++ b/hs20/client/osu_client.c
@@ -2794,18 +2794,20 @@ static int osu_cert_cb(void *_ctx, struct http_cert *cert)
for (j = 0; !ctx->no_osu_cert_validation &&
j < ctx->friendly_name_count; j++) {
int found = 0;
+ int lang_len = os_strlen(ctx->friendly_name[j].lang);
+
for (i = 0; i < cert->num_othername; i++) {
if (os_strcmp(cert->othername[i].oid,
"1.3.6.1.4.1.40808.1.1.1") != 0)
continue;
- if (cert->othername[i].len < 3)
+ if (cert->othername[i].len < lang_len)
continue;
if (os_strncasecmp((char *) cert->othername[i].data,
- ctx->friendly_name[j].lang, 3) != 0)
+ ctx->friendly_name[j].lang, lang_len) != 0)
continue;
- if (os_strncmp((char *) cert->othername[i].data + 3,
+ if (os_strncmp((char *) cert->othername[i].data + lang_len,
ctx->friendly_name[j].text,
- cert->othername[i].len - 3) == 0) {
+ cert->othername[i].len - lang_len) == 0) {
found = 1;
break;
}
--
2.7.4
More information about the Hostap
mailing list