]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stats: use strncmp() instead of memcmp() on health states
authorWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2020 08:26:36 +0000 (10:26 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 11 Aug 2020 08:26:36 +0000 (10:26 +0200)
commit7b52485f1afb7d420633d7794549ec0549d1e2d7
treea50f0acc4d12d600bb44d270d1bbba6373815e22
parent9a1d839f618052b04fc4e40fd5244a54c5a5fbe0
BUG/MINOR: stats: use strncmp() instead of memcmp() on health states

The reports for health states are checked using memcmp() in order to
only focus on the first word and possibly ignore trailing %d/%d etc.
This makes gcc unhappy about a potential use of "" as the string, which
never happens since the string is always set. This resulted in commit
c4e6460f6 ("MINOR: build: Disable -Wstringop-overflow.") to silence
these messages. However some lengths are incorrect (though cannot cause
trouble), and in the end strncmp() is just safer and cleaner.

This can be backported to all stable branches as it will shut a warning
with gcc 8 and above.
src/stats.c