diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-04-03 12:57:57 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-04-03 12:57:57 +0000 |
commit | 23e456ce547052d1bed0f4956bf1e09d0a3a11ff (patch) | |
tree | 38800cbdc08e67e96626d3930524116e66b2154b /sbin/dhclient | |
parent | f1e29dc8bf1e1ba294cd7de9a83b34a2a692196b (diff) |
Take the length of an initialized string, not a
soon-but-not-yet-initialized string.
Should fix "Segmentation fault" reported by Raf
Czlonka.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index b13bb985032..ac3e90d5289 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.631 2019/04/02 02:59:43 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.632 2019/04/03 12:57:56 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -1129,12 +1129,13 @@ packet_to_lease(struct interface_info *ifi, struct option_data *options) name = code_to_name(i); if (i == DHO_DOMAIN_SEARCH) { /* Replace RFC 1035 data with a string. */ - pretty = rfc1035_as_string(options[i].data, options[i].len); + pretty = rfc1035_as_string(options[i].data, + options[i].len); free(options[i].data); options[i].data = strdup(pretty); if (options[i].data == NULL) fatal("RFC1035 string"); - options[i].len = strlen(lease->options[i].data) + 1; + options[i].len = strlen(options[i].data) + 1; } else pretty = pretty_print_option(i, &options[i], 0); if (strlen(pretty) == 0) |