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.
This commit is contained in:
Willy Tarreau 2019-02-12 11:59:35 +01:00
parent 4eee38aa57
commit 9bdd7bc63d

View File

@ -213,9 +213,6 @@ int intencode(uint64_t i, char **str) {
int idx = 0; int idx = 0;
unsigned char *msg; unsigned char *msg;
if (!*str)
return 0;
msg = (unsigned char *)*str; msg = (unsigned char *)*str;
if (i < 240) { if (i < 240) {
msg[0] = (unsigned char)i; msg[0] = (unsigned char)i;