1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 08:35:05 -05:00

vauth/cleartext: Don't send the authzid if it is empty

Follow up to 762a292f.
This commit is contained in:
Steve Holme 2019-04-17 23:06:05 +01:00
parent c8bbfb90ea
commit f0950acc07

View File

@ -73,7 +73,7 @@ CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,
*outlen = 0; *outlen = 0;
*outptr = NULL; *outptr = NULL;
zlen = strlen(authzid); zlen = (authzid == NULL ? 0 : strlen(authzid));
clen = strlen(authcid); clen = strlen(authcid);
plen = strlen(passwd); plen = strlen(passwd);
@ -87,7 +87,8 @@ CURLcode Curl_auth_create_plain_message(struct Curl_easy *data,
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
/* Calculate the reply */ /* Calculate the reply */
memcpy(plainauth, authzid, zlen); if(zlen != 0)
memcpy(plainauth, authzid, zlen);
plainauth[zlen] = '\0'; plainauth[zlen] = '\0';
memcpy(plainauth + zlen + 1, authcid, clen); memcpy(plainauth + zlen + 1, authcid, clen);
plainauth[zlen + clen + 1] = '\0'; plainauth[zlen + clen + 1] = '\0';