From: Emeric Brun Date: Mon, 15 Feb 2021 12:58:06 +0000 (+0100) Subject: BUG/MINOR: dns: add test on result getting value from buffer into ring. X-Git-Tag: v2.4-dev9~48 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=538bb0441c7a28f27389fce957b3b337e82130d9;p=thirdparty%2Fhaproxy.git BUG/MINOR: dns: add test on result getting value from buffer into ring. This patch adds a missing test in dns_session_io_handler, getting the query id from the buffer of the ring. An error should never happen since messages are completely added atomically. This bug should fix github issue #1133 --- diff --git a/src/dns.c b/src/dns.c index 352e88c9aa..bc40b29e80 100644 --- a/src/dns.c +++ b/src/dns.c @@ -522,6 +522,13 @@ static void dns_session_io_handler(struct appctx *appctx) /* backup original query id */ len = b_getblk(buf, (char *)&original_qid, sizeof(original_qid), ofs + cnt); + if (!len) { + /* should never happen since messages are atomically + * written into ring + */ + ret = 0; + break; + } /* generates new query id */ new_qid = ++ds->query_counter;