public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [sysdeps] Fix possible null-pointer dereference.
@ 2022-04-01  6:25 Dmitry Chestnyh
  2022-06-13  7:01 ` Siddhesh Poyarekar
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Chestnyh @ 2022-04-01  6:25 UTC (permalink / raw)
  To: libc-alpha; +Cc: Dmitry Chestnyh

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(-)

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [sysdeps] Fix possible null-pointer dereference.
  2022-04-01  6:25 [PATCH] [sysdeps] Fix possible null-pointer dereference Dmitry Chestnyh
@ 2022-06-13  7:01 ` Siddhesh Poyarekar
  0 siblings, 0 replies; 2+ messages in thread
From: Siddhesh Poyarekar @ 2022-06-13  7:01 UTC (permalink / raw)
  To: Dmitry Chestnyh, libc-alpha

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-13  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01  6:25 [PATCH] [sysdeps] Fix possible null-pointer dereference Dmitry Chestnyh
2022-06-13  7:01 ` Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).