[PATCH] [sysdeps] Fix possible null-pointer dereference.

Siddhesh Poyarekar siddhesh@gotplt.org
Mon Jun 13 07:01:29 GMT 2022


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++];



More information about the Libc-alpha mailing list