public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix crash in resolver on memory allocation failure (bug 23005)
@ 2018-03-27 10:28 Andreas Schwab
  2018-03-27 15:20 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2018-03-27 10:28 UTC (permalink / raw)
  To: libc-alpha

	[BZ #23005]
	* resolv/res_send.c (__res_context_send): Return ENOMEM if
	allocation of private copy of nsaddr_list fails.
---
 resolv/res_send.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/resolv/res_send.c b/resolv/res_send.c
index dde0425a33..7debf143f7 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -471,6 +471,11 @@ __res_context_send (struct resolv_context *ctx,
 					'\0',
 					sizeof (struct sockaddr_in6)
 					- sizeof (struct sockaddr_in));
+			else
+			  {
+			    __set_errno (ENOMEM);
+			    return -1;
+			  }
 		}
 		EXT(statp).nscount = statp->nscount;
 	}
-- 
2.16.3


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] Fix crash in resolver on memory allocation failure (bug 23005)
  2018-03-27 10:28 [PATCH] Fix crash in resolver on memory allocation failure (bug 23005) Andreas Schwab
@ 2018-03-27 15:20 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2018-03-27 15:20 UTC (permalink / raw)
  To: Andreas Schwab, libc-alpha

On 03/27/2018 05:28 AM, Andreas Schwab wrote:
> 	[BZ #23005]
> 	* resolv/res_send.c (__res_context_send): Return ENOMEM if
> 	allocation of private copy of nsaddr_list fails.
> ---
>  resolv/res_send.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/resolv/res_send.c b/resolv/res_send.c
> index dde0425a33..7debf143f7 100644
> --- a/resolv/res_send.c
> +++ b/resolv/res_send.c
> @@ -471,6 +471,11 @@ __res_context_send (struct resolv_context *ctx,
>  					'\0',
>  					sizeof (struct sockaddr_in6)
>  					- sizeof (struct sockaddr_in));
> +			else
> +			  {
> +			    __set_errno (ENOMEM);

OK.

> +			    return -1;

OK, I reviewed the call chain to get there and it looks like -1 should
go all the way to the caller.

> +			  }
>  		}
>  		EXT(statp).nscount = statp->nscount;
>  	}
> 

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

-- 
Cheers,
Carlos.

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

end of thread, other threads:[~2018-03-27 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 10:28 [PATCH] Fix crash in resolver on memory allocation failure (bug 23005) Andreas Schwab
2018-03-27 15:20 ` Carlos O'Donell

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