------------------------------------------------------------ revno: 12409 revision-id: squid3@treenet.co.nz-20121124035254-g4yh4vx3esoyf1d6 parent: squid3@treenet.co.nz-20121124035151-vs4xy4d3okj943hu committer: Amos Jeffries branch nick: 3.3 timestamp: Fri 2012-11-23 20:52:54 -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-20121124035254-g4yh4vx3esoyf1d6 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 6533558e8a8aedb2bff74ba5e152af91e949ac0a # timestamp: 2012-11-24 03:53:46 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121124035151-\ # vs4xy4d3okj943hu # # 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-08-28 13:00:30 +0000 +++ helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc 2012-11-24 03:52:54 +0000 @@ -183,8 +183,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; }