From 94d488d2d55ab3fa44ce6d187dd77c5c3169eae5 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 28 Feb 2020 17:41:20 +0000 Subject: [PATCH] jose: copy typ into jose object without testing for JWT --- include/libwebsockets/lws-jose.h | 2 ++ lib/jose/jws/jose.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/libwebsockets/lws-jose.h b/include/libwebsockets/lws-jose.h index 6d52002e1..247d02c68 100644 --- a/include/libwebsockets/lws-jose.h +++ b/include/libwebsockets/lws-jose.h @@ -119,6 +119,8 @@ struct lws_jose { struct lws_jws_recpient recipient[LWS_JWS_MAX_RECIPIENTS]; + char typ[32]; + /* information from the protected header part */ const struct lws_jose_jwe_alg *alg; const struct lws_jose_jwe_alg *enc_alg; diff --git a/lib/jose/jws/jose.c b/lib/jose/jws/jose.c index 7d9ba33a5..d7aa261f9 100644 --- a/lib/jose/jws/jose.c +++ b/lib/jose/jws/jose.c @@ -228,8 +228,8 @@ lws_jws_jose_cb(struct lejp_ctx *ctx, char reason) return 0; case LJJHI_TYP: /* Optional: string: media type */ - if (strcmp(ctx->buf, "JWT")) - return -1; + lws_strnncpy(args->jose->typ, ctx->buf, ctx->npos, + sizeof(args->jose->typ)); break; case LJJHI_JKU: /* Optional: string */