]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: jws: return size_t in JWS functions
authorWilliam Lallemand <wlallemand@haproxy.com>
Thu, 11 Sep 2025 12:25:03 +0000 (14:25 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Thu, 11 Sep 2025 12:31:32 +0000 (14:31 +0200)
commite52e6f66acadbeac93330c74ef10445b145d00aa
treef89561eca881ab62ec5f62092ac773a434c7b610
parent66a7ebfeef82f6b198aee8c612250c096ae23741
BUG/MEDIUM: jws: return size_t in JWS functions

JWS functions are supposed to return 0 upon error or when nothing was
produced. This was done in order to put easily the return value in
trash->data without having to check the return value.

However functions like a2base64url() or snprintf() could return a
negative value, which would be casted in a unsigned int if this happen.

This patch add checks on the JWS functions to ensure that no negative
value can be returned, and change the prototype from int to size_t.

This is also related to issue #3114.

Must be backported to 3.2.
include/haproxy/jws.h
src/jws.c