Menu

#652 wrong output when print wrong ftp-method

closed-fixed
5
2013-06-21
2007-05-22
mytx
No

When print following command with Curl v7.16.1:
curl ftp://ftpserver/file -u ftptest:ftptest --ftp-ssl-control --cacert data/bin/ca102.crt --trace-time --key data/bin/client.key --cert data/bin/client.crt:123456 --ftp-method "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"

Curl output wrong message.

And I find some source code have wrong.
On file src/main.c--warnf() function:
Line 486-508:
fputs(WARN_PREFIX, config->errors);

if(len > (int)WARN_TEXTWIDTH) {
int cut = WARN_TEXTWIDTH-1;

while(!ISSPACE(ptr[cut]) && cut) {
cut--;
}

fwrite(ptr, cut + 1, 1, config->errors);
fputs("\n", config->errors);
ptr += cut+1; /* skip the space too */
len -= cut;
And can change to:
fputs(WARN_PREFIX, config->errors);

if(len > (int)WARN_TEXTWIDTH) {
int cut = WARN_TEXTWIDTH-1;
while(!ISSPACE(ptr[cut]) && cut) {
cut--;
}
/* changed begin */
if (cut == 0)
cut = WARN_TEXTWIDTH-1;
/* changed end */
fwrite(ptr, cut + 1, 1, config->errors);
fputs("\n", config->errors);
ptr += cut+1; /* skip the space too */
/* changed begin */
len -= (cut+1);
/* changed end */

When cut=0, then ptr+=1 and len-=0, there will be wrong.

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2007-05-24

    Logged In: YES
    user_id=1110
    Originator: NO

    Thanks, applied!

     
  • Daniel Stenberg

    Daniel Stenberg - 2007-05-24
    • status: open --> closed-fixed