summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2021-12-13 09:22:34 +0100
committerGravatar Christian Hesse <mail@eworm.de>2021-12-13 09:22:34 +0100
commitfcd828e19728c6c99d98ba246d2de3352c77507e (patch)
tree7318f486bbdf87d281839981a2b9b4775bba17c7
parent10e7015cce790efe748ff8d0b7f943577e805edf (diff)
downloaddyndhcpd-fcd828e19728c6c99d98ba246d2de3352c77507e.tar.gz
dyndhcpd-fcd828e19728c6c99d98ba246d2de3352c77507e.tar.zst
check valid response from gethostbyname()
-rw-r--r--dyndhcpd.c2
1 files changed, 1 insertions, 1 deletions
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");