[sysdeps] Fix possible null-pointer dereference.
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
Without suggested check we can have null-pointer
dereference at line 257.
---
sysdeps/unix/sysv/linux/check_pf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 01/04/2022 11:55, Dmitry Chestnyh wrote:
> Without suggested check we can have null-pointer
> dereference at line 257.
How so? ISTM that for a valid message (which we rely on the kernel to
provide) you're bound to have at least address or local (and
consequently address) set at all times.
> ---
> sysdeps/unix/sysv/linux/check_pf.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sysdeps/unix/sysv/linux/check_pf.c b/sysdeps/unix/sysv/linux/check_pf.c
> index fe73fe3ba8..5d60e7ac2b 100644
> --- a/sysdeps/unix/sysv/linux/check_pf.c
> +++ b/sysdeps/unix/sysv/linux/check_pf.c
> @@ -237,7 +237,7 @@ make_request (int fd, pid_t pid)
> * sizeof (struct in6addrinfo));
> }
>
> - if (!result)
> + if (!result || !address)
> goto out_fail;
>
> struct in6addrinfo *info = &result->in6ai[result_len++];
@@ -237,7 +237,7 @@ make_request (int fd, pid_t pid)
* sizeof (struct in6addrinfo));
}
- if (!result)
+ if (!result || !address)
goto out_fail;
struct in6addrinfo *info = &result->in6ai[result_len++];