]> granicus.if.org Git - curl/commitdiff
vauth/cleartext: Don't send the authzid if it is empty
authorSteve Holme <steve_holme@hotmail.com>
Wed, 17 Apr 2019 22:06:05 +0000 (23:06 +0100)
committerSteve Holme <steve_holme@hotmail.com>
Sun, 21 Apr 2019 22:34:21 +0000 (23:34 +0100)
Follow up to 762a292f.

lib/vauth/cleartext.c

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