From 53c4c5c85942d4733f4723531c4d325235448326 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Date: Fri, 18 Oct 2013 13:53:05 +0100 Subject: [PATCH] Fix crash at startup when dhcp-host with client-ids is present. --- src/dhcp-common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dhcp-common.c b/src/dhcp-common.c index 028178a..a92d728 100644 --- a/src/dhcp-common.c +++ b/src/dhcp-common.c @@ -315,8 +315,9 @@ struct dhcp_config *find_config(struct dhcp_config *configs, return config; /* dhcpcd prefixes ASCII client IDs by zero which is wrong, but we try and - cope with that here */ - if (!(context->flags & CONTEXT_V6) && *clid == 0 && config->clid_len == clid_len-1 && + cope with that here. This is IPv4 only. context==NULL implies IPv4, + see lease_update_from_configs() */ + if ((!context || !(context->flags & CONTEXT_V6)) && *clid == 0 && config->clid_len == clid_len-1 && memcmp(config->clid, clid+1, clid_len-1) == 0 && is_config_in_context(context, config)) return config;