diff --git a/lib/jose/jws/jws.c b/lib/jose/jws/jws.c index 2b37fd4f9..b568104d3 100644 --- a/lib/jose/jws/jws.c +++ b/lib/jose/jws/jws.c @@ -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; } diff --git a/minimal-examples/api-tests/api-test-jose/jws.c b/minimal-examples/api-tests/api-test-jose/jws.c index 2236d928a..8fc6ad5ed 100644 --- a/minimal-examples/api-tests/api-test-jose/jws.c +++ b/minimal-examples/api-tests/api-test-jose/jws.c @@ -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; }