Skip to content
Permalink
Browse files

tool_getparam: Don't re-use nlen variable

  • Loading branch information
bbakersmith committed Feb 14, 2020
1 parent 9e97215 commit 1ce599abb016dd282e5c8e879ae73fe8b2292f93
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/tool_getparam.c
@@ -1444,10 +1444,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
return PARAM_NO_MEM;
}

nlen = strlen(encname);
size_t encnamelen = strlen(encname);

/* create the final encoded string */
size_t outlen = nlen + strlen(encvalue) + 2;
size_t outlen = encnamelen + strlen(encvalue) + 2;
char *n = malloc(outlen);
if(!n) {
curl_free(encvalue);
@@ -1456,7 +1456,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
}

if(nlen > 0) { /* only append '=' if we have a name */
msnprintf(n, outlen, "%.*s=%s", nlen, encname, encvalue);
msnprintf(n, outlen, "%.*s=%s", encnamelen, encname, encvalue);
size = outlen-1;
}
else {

0 comments on commit 1ce599a

Please sign in to comment.
You can’t perform that action at this time.