wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wget2 | Draft: Small fixes (!505)


From: @rockdaboot
Subject: Re: wget2 | Draft: Small fixes (!505)
Date: Sat, 28 May 2022 17:50:06 +0000



Tim Rühsen started a new discussion on libwget/http.c: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/505#note_963275898

>  
>               if (nread < 4) continue;
>  
> -             if (nread - nbytes <= 4)
> +             if (nread - nbytes <= 3)

This changes the code in case where `nread - nbytes == 4`. The original code 
does `p = buf`, your code does `p = buf + 1`.

Let's say buf="\r", nread=1 and the read gets 4 more bytes "\n\r\nx", so 
nbytes=4.

With your change the check is `if (5 - 1 <= 3)` which is false. p now becomes 
buf+1, which points to "\n\r\nx". Oops, the strstr() returns NULL and we missed 
the end of the HTTP header !

I wonder how we can craft a test for this situation.

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/505#note_963275898
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]