summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2021-10-16 14:54:19 +0200
committerWilly Tarreau <w@1wt.eu>2021-10-16 14:54:19 +0200
commit7c4c830d04d53ed31e10a4f849b8ff96034e7690 (patch)
treeb0328b18c2316a503410e7550402c18bb7d83aea
parenta146289d4f3b9940f20ae1640b26fa939761224b (diff)
downloadhaproxy-7c4c830d04d53ed31e10a4f849b8ff96034e7690.tar.gz
BUG/MINOR: listener: add an error check for unallocatable trash
Coverity noticed in issue #1416 that a missing allocation error was introduced in tcp_bind_listener() with the rework of error messages by commit ed1748553 ("MINOR: proto_tcp: use chunk_appendf() to ouput socket setup errors"). In practice nobody will ever face it but better address it anyway. No backport is needed.
-rw-r--r--src/proto_tcp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index 18e9b80e4..a8b15b21a 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -589,6 +589,12 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
err = ERR_NONE;
+ if (!msg) {
+ if (errlen)
+ snprintf(errmsg, errlen, "out of memory");
+ return ERR_ALERT | ERR_FATAL;
+ }
+
/* ensure we never return garbage */
if (errlen)
*errmsg = 0;