]> git.kaiwu.me - haproxy.git/commit
BUILD: ssl/sample: potential null pointer dereference in sample_conv_aes
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 20 Apr 2026 08:58:08 +0000 (10:58 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 20 Apr 2026 09:00:24 +0000 (11:00 +0200)
commit95e9629530e07682ffd061e92e0e51506e4b3f70
tree0df5b7fccef0250107d44bd7d6ee7c2b127880f9
parentde7ab831a32c0e4fa06ba8e9bc425c65075da13e
BUILD: ssl/sample: potential null pointer dereference in sample_conv_aes

gcc flags aead_tag_trash as potentially NULL at the chunk_memcpy call
inside the (!dec && gcm) block, because it cannot correlate the
condition with the allocation that only happens in that same branch. Add
an explicit NULL check to silence the warning.

This was caught by cross-zoo.yml:

In file included from include/haproxy/connection.h:28,
                 from src/ssl_sample.c:27:
In function ‘b_orig’,
    inlined from ‘sample_conv_aes’ at src/ssl_sample.c:540:23:
include/haproxy/buf.h:80:17: error: potential null pointer dereference [-Werror=null-dereference]
   80 |         return b->area;
      |                ~^~~~~~
In function ‘b_data’,
    inlined from ‘sample_conv_aes’ at src/ssl_sample.c:540:3:
include/haproxy/buf.h:100:17: error: potential null pointer dereference [-Werror=null-dereference]
  100 |         return b->data;
      |                ~^~~~~~
src/ssl_sample.c