From a6b24b7afb79294e6b709ede11395f13370d67a0 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Thu, 21 Feb 2013 20:10:41 -0800 Subject: [PATCH] gethostbyname: fix crash When an app doesn't have the internet permission, android_open_proxy returns NULL, causing a segfault when calling fprintf. Fixed. Change-Id: I598855350ed0db3cc88e5ae3b400145418a3a615 --- libc/netbsd/gethnamaddr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/netbsd/gethnamaddr.c b/libc/netbsd/gethnamaddr.c index 1ab987e13..2cb5fd346 100644 --- a/libc/netbsd/gethnamaddr.c +++ b/libc/netbsd/gethnamaddr.c @@ -753,6 +753,7 @@ gethostbyname_internal(const char *name, int af, res_state res, const char *ifac } proxy = android_open_proxy(); + if (proxy == NULL) goto exit; /* This is writing to system/netd/DnsProxyListener.cpp and changes * here need to be matched there */