[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (
From: |
@rockdaboot |
Subject: |
Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521) |
Date: |
Sun, 09 Apr 2023 11:31:19 +0000 |
Tim Rühsen started a new discussion on libwget/http.c:
https://gitlab.com/gnuwget/wget2/-/merge_requests/521#note_1346093104
> + return no_proxies;
> +}
> +
> +bool wget_http_cidr_match(const char *cidr, struct in_addr *addr)
> +{
> + char *slash_pos = strchr(cidr, '/');
> + if (slash_pos == NULL)
> + {
> + return false; // invalid CIDR range
> + }
> + int prefix_len = atoi(slash_pos + 1);
> + if (prefix_len < 0 || prefix_len > 32)
> + {
> + return false; // invalid prefix length
> + }
> + *slash_pos = '\0';
Here, you break the promise of `const char *cidr`, even if you restore `/`
afterwards. Two threads, using the same constant `cidr` input at the same time
may run into issues here.
Since inet_aton() does not take the length of the input string, you have to
create a copy instead.
Like with `const char *prefix = wget_strmemdup(cidr, slash_pos - cidr)`.
--
Reply to this email directly or view it on GitLab:
https://gitlab.com/gnuwget/wget2/-/merge_requests/521#note_1346093104
You're receiving this email because of your account on gitlab.com.
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/01
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/09
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521),
@rockdaboot <=
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/09
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/09
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/09
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/09
- Re: wget2 | Draft: CIDR support added for No Proxy. Testing Code Added (!521), @rockdaboot, 2023/04/09