From b1aad0da4e65102964300db05c33d49c378b35a9 Mon Sep 17 00:00:00 2001 From: krw Date: Wed, 31 Mar 2021 20:52:09 +0000 Subject: [PATCH] Add two missing checks for strdup() returning NULL. --- sbin/dhclient/dhclient.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 97fe48c0174..919c6e64eb3 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.716 2021/03/31 15:32:11 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.717 2021/03/31 20:52:09 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -2370,10 +2370,14 @@ apply_defaults(struct client_lease *lease) if (config->filename != NULL) { free(newlease->filename); newlease->filename = strdup(config->filename); + if (newlease->filename == NULL) + fatal("strdup(config->filename)"); } if (config->server_name != NULL) { free(newlease->server_name); newlease->server_name = strdup(config->server_name); + if (newlease->server_name == NULL) + fatal("strdup(config->server_name)"); } if (config->address.s_addr != INADDR_ANY) newlease->address.s_addr = config->address.s_addr; -- 2.20.1