------------------------------------------------------------ revno: 11725 revision-id: squid3@treenet.co.nz-20121130133040-tert6g50qyzg3c2b parent: squid3@treenet.co.nz-20121130132533-dkc7kng014rju405 committer: Amos Jeffries branch nick: 3.2 timestamp: Fri 2012-11-30 06:30:40 -0700 message: ntlm_smb_lm_auth: better bounds checking Protect against overflow of domain and domain controlleler FQDN buffers leading to missing nul-termination string errors. Detected by Coverity Scan. Issue 740475. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121130133040-tert6g50qyzg3c2b # target_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # testament_sha1: 9f371477ae8a40a6cf3716978cea63196b548a12 # timestamp: 2012-11-30 13:41:39 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/branches\ # /SQUID_3_2 # base_revision_id: squid3@treenet.co.nz-20121130132533-\ # dkc7kng014rju405 # # Begin patch === modified file 'helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc' --- helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc 2012-07-28 05:38:50 +0000 +++ helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc 2012-11-30 13:30:40 +0000 @@ -191,8 +191,11 @@ { /* trying to circumvent some strange problem wih pointers in SMBLib */ /* Ugly as hell, but the lib is going to be dropped... */ - strcpy(my_domain,domain); - strcpy(my_domain_controller,domain_controller); + strncpy(my_domain, domain, sizeof(my_domain)-1); + my_domain[sizeof(my_domain)-1] = '\0'; + strncpy(my_domain_controller, domain_controller, sizeof(my_domain_controller)-1); + my_domain_controller[sizeof(my_domain_controller)-1] = '\0'; + if (init_challenge(my_domain, my_domain_controller) > 0) { return NULL; }