From: Amos Jeffries Date: Mon, 26 Nov 2012 08:35:13 +0000 (-0700) Subject: digest_edirectory_auth: improved error handling X-Git-Tag: SQUID_3_2_4~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92167619dc8f409c69292eee3d93dedbc46cadde;p=thirdparty%2Fsquid.git digest_edirectory_auth: improved error handling 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 --- diff --git a/helpers/digest_auth/eDirectory/ldap_backend.cc b/helpers/digest_auth/eDirectory/ldap_backend.cc index 2c1f7a4f1f..134dab943c 100644 --- a/helpers/digest_auth/eDirectory/ldap_backend.cc +++ b/helpers/digest_auth/eDirectory/ldap_backend.cc @@ -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; }