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:
parent
b177435945
commit
5b780b85b5
2 changed files with 4 additions and 3 deletions
|
@ -462,7 +462,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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue