From: Willy Tarreau Date: Tue, 12 Feb 2019 10:59:35 +0000 (+0100) Subject: BUILD/MINOR: peers: remove an impossible null test in intencode() X-Git-Tag: v2.0-dev1~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9bdd7bc63d94501e649bc0f5c0c3d4a4288004cc;p=thirdparty%2Fhaproxy.git BUILD/MINOR: peers: remove an impossible null test in intencode() intencode() tests for the nullity of the target pointer passed in argument, but the code calling intencode() never does so and happily dereferences it. gcc at -O3 detects this as a potential null deref. Let's remove this incorrect and misleading test. If this pointer was null, the code would already crash in the calling functions. This must be backported to stable versions. --- diff --git a/src/peers.c b/src/peers.c index 30cf94277d..dc5bdeaf8d 100644 --- a/src/peers.c +++ b/src/peers.c @@ -213,9 +213,6 @@ int intencode(uint64_t i, char **str) { int idx = 0; unsigned char *msg; - if (!*str) - return 0; - msg = (unsigned char *)*str; if (i < 240) { msg[0] = (unsigned char)i;