curl-library
Patch: curl_ntlm_msgs.c: Fixed passwdlen not being used and recalculated
Date: Mon, 11 Jun 2012 02:26:36 +0200
Hello everyone,
I just spotted this small mistake while doing mingw32-make builds.
gcc -I. -I../include -g -O2 -Wall -fno-strict-aliasing
-DBUILDING_LIBCURL -DUSE_WINDOWS_SSPI -DUSE_SCHANNEL -c
curl_ntlm_msgs.c
curl_ntlm_msgs.c: In function 'Curl_ntlm_create_type1_message':
curl_ntlm_msgs.c:402:10: warning: variable 'passwdlen' set but not
used [-Wunused-but-set-variable]
The variable is calculated like this:
if(passwdp)
passwdlen = strlen(passwdp);
But then the length value was recalculated instead of the variable being used:
ntlm->identity.UserLength = (unsigned long)userlen;
if((ntlm->identity.Password = (unsigned char *)strdup(passwdp)) == NULL)
return CURLE_OUT_OF_MEMORY;
ntlm->identity.PasswordLength = (unsigned long)strlen(passwdp);
if((ntlm->identity.Domain = malloc(domlen + 1)) == NULL)
return CURLE_OUT_OF_MEMORY;
I changed that to the following:
ntlm->identity.UserLength = (unsigned long)userlen;
if((ntlm->identity.Password = (unsigned char *)strdup(passwdp)) == NULL)
return CURLE_OUT_OF_MEMORY;
ntlm->identity.PasswordLength = (unsigned long)passwdlen;
if((ntlm->identity.Domain = malloc(domlen + 1)) == NULL)
return CURLE_OUT_OF_MEMORY;
Attached you will find the corresponding patch against the master branch.
Best regards,
Marc
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- application/octet-stream attachment: 0001-curl_ntlm_msgs.c-Fixed-passwdlen-not-being-used-and-.patch