From fcd828e19728c6c99d98ba246d2de3352c77507e Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 13 Dec 2021 09:22:34 +0100 Subject: check valid response from gethostbyname() --- dyndhcpd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dyndhcpd.c b/dyndhcpd.c index 82c20ee..873dc75 100644 --- a/dyndhcpd.c +++ b/dyndhcpd.c @@ -142,7 +142,7 @@ int main(int argc, char ** argv) { /* get the domainname */ hp = gethostbyname(hostname); - if ((domainname = strchr(hp->h_name, '.')) != NULL) + if (hp && (domainname = strchr(hp->h_name, '.')) != NULL) domainname++; else { fprintf(stderr, "Could not get domainname, using '" FALLBACKDOMAIN "'\n"); -- cgit v1.2.3-70-g09d2