siva-msft / curl

Other
0 stars 0 forks source link

Potential security issue in src/tool_operate.c: Unchecked return from initialization function #37

Closed monocle-ai closed 4 years ago

monocle-ai commented 4 years ago

What is a Conditionally Uninitialized Variable? The return value of a function that is potentially used to initialize a local variable is not checked. Therefore, reading the local variable may result in undefined behavior.

1 instance of this defect were found in the following locations:

Instance 1 File : src/tool_operate.c Function: post_per_transfer https://github.com/siva-msft/curl/blob/3c26766b1c420f0920e90b4453d14e7b5fc01cdf/src/tool_operate.c#L2141 Code extract:

          curl_easy_getinfo(easy, CURLINFO_PRIVATE, (void *)&ended);
          curl_multi_remove_handle(multi, easy);

          result = post_per_transfer(global, ended, result, &retry); <------ HERE
          if(retry)
            continue;

How can I fix it? Correct reference usage found in src/tool_operate.c at line 2212. https://github.com/siva-msft/curl/blob/3c26766b1c420f0920e90b4453d14e7b5fc01cdf/src/tool_operate.c#L2212 Code extract:

    /* store the result of the actual transfer */
    returncode = result;

    result = post_per_transfer(global, per, result, &retry); <------ HERE
    if(retry)
      continue;
siva-msft commented 4 years ago

assign.