cURL / Mailing Lists / curl-users / Single Mail

curl-users

回复: Re: 回复: Re: Patch to make curl support file://upload/ resume

From: 峰 涂 <tu0151034_at_yahoo.com.cn>
Date: Thu, 31 May 2007 11:57:46 +0800 (CST)

hi Dan,
  Thank you very much for your reminding. I have fixed it.

Dan Fandrich <dan_at_coneharvesters.com> 写道:
  On Wed, May 30, 2007 at 03:15:29PM +0800, 峰 涂 wrote:
> hi, I have adjusted my patch as your requirements.

I've noticed another couple of things:

> + if(stat(file->path, &file_stat)){
> + failf(data, "Can't get the size of %s", file->path);
> + return CURLE_WRITE_ERROR;

If this error path is taken, it will leak a file descriptor.

> + if(data->reqdata.resume_from){
> + if( nread <= data->reqdata.resume_from ){
> + data->reqdata.resume_from -= nread;
> + nread = 0;

If this condition is true, then the call to fwrite below will pass in an
uninitialized buf2 variable on the first pass.

> + }
> + else{
> + buf2 = buf + data->reqdata.resume_from;
> + nread -= data->reqdata.resume_from;
> + data->reqdata.resume_from = 0;
> + }
> + }
> + else
> + buf2 = buf;
> +
> /* write the data to the target */
> - nwrite = fwrite(buf, 1, nread, fp);
> + nwrite = fwrite(buf2, 1, nread, fp);
> if(nwrite != nread) {
> res = CURLE_SEND_ERROR;
> break;

>>> Dan

-- 
http://www.MoveAnnouncer.com The web change of address service
Let webmasters know that your web site has moved
 		
---------------------------------
 Mp3疯狂搜-新歌热歌高速下   

Received on 2007-05-31