From 9bdd7bc63d94501e649bc0f5c0c3d4a4288004cc Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 12 Feb 2019 11:59:35 +0100 Subject: [PATCH] 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. --- src/peers.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/peers.c b/src/peers.c index 30cf94277..dc5bdeaf8 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; -- 2.47.3