From: Craig Gowing Date: Wed, 30 Sep 2020 16:46:39 +0000 (+0000) Subject: Bug 5076: WCCP Security Info incorrect (#725) X-Git-Tag: SQUID_5_0_5~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F737%2Fhead;p=thirdparty%2Fsquid.git Bug 5076: WCCP Security Info incorrect (#725) When generating and validating WCCP2 Security Info use only an 8 byte password. --- diff --git a/src/wccp2.cc b/src/wccp2.cc index 61e31f9220..cfa885ce6d 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -584,7 +584,9 @@ wccp2_update_md5_security(char *password, char *ptr, char *packet, int len) SquidMD5Init(&M); - SquidMD5Update(&M, pwd, sizeof(pwd)); + static_assert(sizeof(pwd) - 1 == 8, "WCCP2 password has exactly 8 (padded) octets, excluding storage-terminating NUL"); + + SquidMD5Update(&M, pwd, sizeof(pwd) - 1); SquidMD5Update(&M, packet, len); @@ -638,7 +640,9 @@ wccp2_check_security(struct wccp2_service_list_t *srv, char *security, char *pac SquidMD5Init(&M); - SquidMD5Update(&M, pwd, sizeof(pwd)); + static_assert(sizeof(pwd) - 1 == 8, "WCCP2 password has exactly 8 (padded) octets, excluding storage-terminating NUL"); + + SquidMD5Update(&M, pwd, sizeof(pwd) - 1); SquidMD5Update(&M, packet, len);