]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix the invalid condition variable
authorOndřej Surý <ondrej@sury.org>
Tue, 9 Feb 2021 12:25:52 +0000 (13:25 +0100)
committerOndřej Surý <ondrej@sury.org>
Thu, 18 Feb 2021 18:33:54 +0000 (19:33 +0100)
Although harmless, the memmove() in tlsdns and tcpdns was guarded by a
current message length variable that was always bigger than 0 instead of
correct current buffer length remainder variable.

lib/isc/netmgr/tcpdns.c
lib/isc/netmgr/tlsdns.c

index cbc2cab0edb5a1f2003f035697098dcb87ecbb41..d7b8bbde426075555e5f77d32bd1d9c32d6441b8 100644 (file)
@@ -999,7 +999,7 @@ processbuffer(isc_nmsocket_t *sock) {
 
        len += 2;
        sock->buf_len -= len;
-       if (len > 0) {
+       if (sock->buf_len > 0) {
                memmove(sock->buf, sock->buf + len, sock->buf_len);
        }
 
index d518dc97eccebe1a444aea2aa5efde48fe7435e0..90aa605232b08033c1c2ad4e6fedac665d86fe4f 100644 (file)
@@ -1147,7 +1147,7 @@ processbuffer(isc_nmsocket_t *sock) {
 
        len += 2;
        sock->buf_len -= len;
-       if (len > 0) {
+       if (sock->buf_len > 0) {
                memmove(sock->buf, sock->buf + len, sock->buf_len);
        }