]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: jwt: Memory leak if same key is used in multiple jwt_verify calls
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Fri, 4 Feb 2022 13:24:15 +0000 (14:24 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 15 Feb 2022 19:08:20 +0000 (20:08 +0100)
commitd544d33e10868963407212660466aa552d5888e6
tree7b0659f5bbf58c99903f41d5dc54a4884ac950d7
parent2b5a6559460b41dd6db2740cc961b461cef12edc
BUG/MINOR: jwt: Memory leak if same key is used in multiple jwt_verify calls

If the same filename was specified in multiple calls of the jwt_verify
converter, we would have parsed the contents of the file every time it
was used instead of checking if the entry already existed in the tree.
This lead to memory leaks because we would not insert the duplicated
entry and we would not free it (as well as the EVP_PKEY it referenced).
We now check the return value of ebst_insert and free the current entry
if it is a duplicate of an existing entry.
The order in which the tree insert and the pkey parsing happen was also
switched in order to avoid parsing key files in case of duplicates.

Should be backported to 2.5.
src/jwt.c