]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: errors: handle malloc failure in usermsgs_put()
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 11 May 2023 16:49:14 +0000 (18:49 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 12 May 2023 07:45:30 +0000 (09:45 +0200)
commitd4dba38ab101eee4cbd0c8d8aa21181825ef6472
treebd6c8ec5355f597e16f0eced7bd2d47873ed8bd7
parent4cc2714ae2b40b84b1ee361dceab71a3acd8fb4a
BUG/MINOR: errors: handle malloc failure in usermsgs_put()

usermsgs_buf.size is set without first checking if previous malloc
attempt succeeded.

This could fool the buffer API into assuming that the buffer is
initialized, resulting in unsafe read/writes.

Guarding usermsgs_buf.size assignment with the malloc attempt result
to make the buffer initialization safe against malloc failures.

This partially fixes GH #2130.

It should be backported up to 2.6.
src/errors.c