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.
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) {