1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

COV225132: check if no JOSE alg

In the cases where an alg was expected, make sure it
came.
This commit is contained in:
Andy Green 2019-09-17 09:25:31 +01:00
parent cd207447e0
commit 280c94bace
2 changed files with 4 additions and 3 deletions

View file

@ -459,7 +459,7 @@ lws_jws_sig_confirm(struct lws_jws_map *map_b64, struct lws_jws_map *map,
b = 2;
if (lws_jws_parse_jose(&jose, map->buf[LJWS_JOSE], map->len[LJWS_JOSE],
temp, &temp_len) < 0) {
temp, &temp_len) < 0 || !jose.alg) {
lwsl_notice("%s: parse failed\n", __func__);
return -1;
}

View file

@ -63,7 +63,7 @@ test_jws_none(struct lws_context *context)
if (lws_jws_parse_jose(&jose, map.buf[LJWS_JOSE],
map.len[LJWS_JOSE],
(char *)lws_concat_temp(temp, temp_len),
&temp_len) < 0) {
&temp_len) < 0 || !jose.alg) {
lwsl_err("%s: JOSE parse failed\n", __func__);
goto bail;
}
@ -131,7 +131,8 @@ test_jws_HS256(struct lws_context *context)
/* parse the JOSE header */
if (lws_jws_parse_jose(&jose, test1, strlen(test1), temp, &temp_len) < 0) {
if (lws_jws_parse_jose(&jose, test1, strlen(test1), temp, &temp_len) < 0 ||
!jose.alg) {
lwsl_err("%s: JOSE parse failed\n", __func__);
goto bail;
}