From: Christopher Faulet Date: Tue, 15 Sep 2026 05:36:27 +0000 (+0200) Subject: BUG/MINOR: tools: Don't try to anonymize a NULL string X-Git-Tag: v3.5-dev8~178 X-Git-Url: https://git.kaiwu.me/?a=commitdiff_plain;h=eaec3e46387c77dd2e7a490d116fe753dab6021d;p=haproxy.git BUG/MINOR: tools: Don't try to anonymize a NULL string hash_anon() function is used to anonymize a string. It is called at several places (via HA_ANON_* macros), especially from debugging functions. It is hard to be sure the string to hash is always defined. So let's return immediately if it is NULL. Among other things, this fix avoids to get a crash when the server name created by a LUA CO-SOCKET is anonymized. Indeed, this server is created with no name. This patch should fix the issue #3491. It must be backported as far as 2.8. --- diff --git a/src/tools.c b/src/tools.c index 62fd2bdcf..50e78389a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7423,7 +7423,7 @@ const char *hash_anon(uint32_t scramble, const char *string2hash, const char *pr index_hash = 0; /* don't hash empty strings */ - if (!string2hash[0] || (string2hash[0] == ' ' && string2hash[1] == 0)) + if (!string2hash || !string2hash[0] || (string2hash[0] == ' ' && string2hash[1] == 0)) return string2hash; if (scramble != 0) {