cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-611823 ] segfault ftp'ing (revised 611811)

From: <noreply_at_sourceforge.net>
Date: Thu, 19 Sep 2002 13:57:19 -0700

Bugs item #611823, was opened at 2002-09-19 13:57
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=611823&group_id=976

Category: libcurl
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: segfault ftp'ing (revised 611811)

Initial Comment:
I just submitted the segfaulting ftp bug a few minutes
ago (611811).
Checking over the source code in lib/hostip.c, I find
at least one other
place where the variable "buf" is allocated as an
integer pointer, but then manipulated as if it were a
byte pointer. This especially affects 64-bit
machines where the sizeof "long" is much bigger than
the type of
"character". Here is the revised patch.

Craig Markwardt
craigm_at_lheamail.gsfc.nasa.gov

--- hostip.c~ Tue Jun 11 10:10:38 2002
+++ hostip.c Thu Sep 19 15:52:28 2002
@@ -526,7 +526,7 @@
 
   if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
     struct in_addr *addrentry;
- long *buf = (long *)malloc(sizeof(struct
hostent)+128);
+ char *buf = (char *)malloc(sizeof(struct
hostent)+128);
     if(!buf)
       return NULL; /* major failure */
     *bufp = (char *)buf;
@@ -627,7 +627,7 @@
 
       ret = gethostbyname_r(hostname,
                             (struct hostent *)buf,
- (struct hostent_data
*)(buf + sizeof(struct hostent)));
+ (struct hostent_data
*)((char *)buf + sizeof(struct hostent)));
     else
       ret = -1; /* failure, too smallish buffer size
*/
     

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

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

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-09-19