mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 14:50:59 +01:00
BUG/MEDIUM: sample/jwt: fix another instance of base64 error detection
This is the same as for commit 468c000db ("BUG/MEDIUM: jwt: fix base64
decoding error detection"), but for function sample_conv_jwt_member_query()
that is used by sample converters jwt_header_query() and jwt_payload_query().
Thanks to Tim for the report. No backport is needed.
This commit is contained in:
parent
0eba94e98c
commit
e20e026033
@ -3561,6 +3561,7 @@ static int sample_conv_jwt_member_query(const struct arg *args, struct sample *s
|
|||||||
unsigned int item_num = member + 1; /* We don't need to tokenize the full token */
|
unsigned int item_num = member + 1; /* We don't need to tokenize the full token */
|
||||||
struct buffer *decoded_header = get_trash_chunk();
|
struct buffer *decoded_header = get_trash_chunk();
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
int ret;
|
||||||
|
|
||||||
jwt_tokenize(&smp->data.u.str, items, &item_num);
|
jwt_tokenize(&smp->data.u.str, items, &item_num);
|
||||||
|
|
||||||
@ -3571,12 +3572,12 @@ static int sample_conv_jwt_member_query(const struct arg *args, struct sample *s
|
|||||||
if (!decoded_header)
|
if (!decoded_header)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
decoded_header->data = base64urldec(items[member].start, items[member].length,
|
ret = base64urldec(items[member].start, items[member].length,
|
||||||
decoded_header->area, decoded_header->size);
|
decoded_header->area, decoded_header->size);
|
||||||
|
if (ret == -1)
|
||||||
if (decoded_header->data == (unsigned int)-1)
|
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
decoded_header->data = ret;
|
||||||
if (args[0].type != ARGT_STR) {
|
if (args[0].type != ARGT_STR) {
|
||||||
smp->data.u.str = *decoded_header;
|
smp->data.u.str = *decoded_header;
|
||||||
smp->data.type = SMP_T_STR;
|
smp->data.type = SMP_T_STR;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user