cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-875815 ] uninitialized var in transfer.c

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 12 Jan 2004 17:28:20 -0800

Bugs item #875815, was opened at 2004-01-12 17:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=875815&group_id=976

Category: libcurl
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: uninitialized var in transfer.c

Initial Comment:
libcurl version 7.10.8. Compiling on WinXP with .NET
2003. Received a warning:

curl\lib\transfer.c(1861) : warning C4700: local
variable 'gotourl' used without having been initialized

surrounding code looks like:

      if ((CURLE_OK == res) && urlchanged) {
        char *gotourl;
        res = Curl_done(conn);
        if(CURLE_OK == res) {
          newurl = strdup(data->change.url);
          res = Curl_follow(data, gotourl); <----- here
          if(res)
            free(gotourl); /* problem here too */
        }
      }

variable "gotourl" is never initialized. Curl_follow() calls
sscanf on the passed char*. If this code ever gets hit,
it will crash, if not on the sscanf, it will crash on the free
(). Not sure what gotourl should be initialized to in this
situation. Perhaps the intention was to pass newurl? In
which case gotourl could probably just go away.

Any questions, please feel free to contact me.

Darrick Brown
dbrown_at_macromedia.com

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=875815&group_id=976

-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
Received on 2004-01-13