]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
digest_edirectory_auth: improved error handling
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 26 Nov 2012 08:35:13 +0000 (01:35 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 26 Nov 2012 08:35:13 +0000 (01:35 -0700)
Malicious response from LDAP server can cause squid helper to crash.

Missing realm value returned from LDAP without error/missing value being
indicated in the response can lead to strcmp() using a NULL pointer.
 Extremely unlikely to happen in practice, but worth fixing.

 Detected by Coverity Scan. Issue 740399

helpers/digest_auth/eDirectory/ldap_backend.cc

index 2c1f7a4f1ff0f2900e966b0d9205685f14cbea9e..134dab943c1030c05b1b556a6da251a5ba5acd8f 100644 (file)
@@ -286,7 +286,8 @@ retrydnattr:
             value = values;
             while (*value) {
                 if (encrpass) {
-                    if (strcmp(strtok(*value, delimiter), realm) == 0) {
+                    const char *t = strtok(*value, delimiter);
+                    if (t && strcmp(t, realm) == 0) {
                         password = strtok(NULL, delimiter);
                         break;
                     }