]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9803 Drop connection when receiving non-LDAP data
authorOndřej Kuzník <ondra@mistotebe.net>
Mon, 7 Mar 2022 10:06:49 +0000 (10:06 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 21 Mar 2022 16:46:31 +0000 (16:46 +0000)
libraries/libldap/result.c

index c1b4a457f0a2729be7b08c9f466313ad290522fd..40ff1c1722d2a3934fb30c4b47179b032bcd3ce0 100644 (file)
@@ -506,6 +506,16 @@ nextresp3:
                lc->lconn_ber = NULL;
                break;
 
+       default:
+               /*
+                * We read a BerElement that isn't LDAP or the stream has desync'd.
+                * In either case, anything we read from now on is probably garbage,
+                * just drop the connection.
+                */
+               ber_free( ber, 1 );
+               lc->lconn_ber = NULL;
+               /* FALLTHRU */
+
        case LBER_DEFAULT:
 fail:
                err = sock_errno();
@@ -521,10 +531,6 @@ fail:
                }
                lc->lconn_status = 0;
                return -1;
-
-       default:
-               ld->ld_errno = LDAP_LOCAL_ERROR;
-               return -1;
        }
 
        /* message id */