cURL / Mailing Lists / curl-library / Single Mail


Re: small patches for ssh (Daniel Stenberg)

From: Ellié Computing Open Source Program <>
Date: Sat, 24 Dec 2011 18:07:48 +0100

>From: Daniel Stenberg <>
>>On Thu, 22 Dec 2011, Elli? Computing Open Source Program wrote:
>> here are two small fixes for SSH:

>Thanks a lot! It would be even more helpful if you would commit them with a
>proper commit message and then generate them with 'git format-patch' or send
>them with with 'git send-email' etc.

uh, I just used git for our own tool, never used it actively, I’ll know it now.

>Now I'm left curious about one of the patches and I'm left to figure out what
>to do with your name as it seems unlikely that what's in your From: is what
>you're actually called...
>> 1. QUOTE mkdir should honor the option CURLOPT_NEW_DIRECTORY_PERMS
>This seems clear. I'll apply and push.
>> 2. Links should have PATH_MAX room (not 80 chars)
>> - sshc->readdir_totalLen = 80 + sshc->readdir_currLen;
>> + sshc->readdir_totalLen = PATH_MAX + sshc->readdir_currLen;
>Why? Please elaborate and explain why it needs such a large buffer there.

Re-reading the code I just don’t understand anymore why it is needed, it just works... whereas the old value of 80 would truncate long links. In my tests I got a truncated link name at 76 chars with the trailing \0 missing putting my FTP parsing stuff out of order, but I believe now that the existing code should have work.....

Duh, I found the bug: near the code :

new_readdir_line = realloc(sshc->readdir_line,
                                 sshc->readdir_totalLen + 4 +

at line 1890, the total length “sshc->readdir_totalLen” is not updated... hence it worked with the PATH_MAX value...
better than that simply add the line:
sshc->readdir_totalLen += 4 + sshc->readdir_len;

Best regards
Armel Asselin

List admin:
Received on 2011-12-24