]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: ssl/sample: check output buffer size in aes_cbc_enc converter
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 4 May 2026 15:34:13 +0000 (17:34 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 4 May 2026 15:38:15 +0000 (17:38 +0200)
commit726aa2dfb2a27cd9ae29b56b8416ec5f6aa4aa8b
tree92eee2cb965dfe7a373932d5db80ef6796aec1f7
parentb9028ee1e40b7ba8edda20730285c12870ebbf2b
BUG/MEDIUM: ssl/sample: check output buffer size in aes_cbc_enc converter

AES-CBC uses a 16-byte block size, and PKCS padding always adds at least
one byte (up to a full 16 bytes when input is already block-aligned), so
the encrypted output is always larger than the input. Without checking
that the output buffer can hold the padded result, encryption could
overflow it. Add a pre-encryption guard for block cipher (blksize > 1)
that rejects the operation when the output buffer is too small.

No backport needed.

Reported-by: Omkhar Arasaratnam <omkhar@linkedin.com>
src/ssl_sample.c