summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2016-10-12 13:36:39 +0000
committerkrw <krw@openbsd.org>2016-10-12 13:36:39 +0000
commit8d148acd8c17095469f326765c0ea01251b47d97 (patch)
tree5e1aec39c8fdc95ae58036e17d8caabfe1b8b236
parentRedraw selection in tty_draw_line, so it appears when redrawing whole (diff)
downloadwireguard-openbsd-8d148acd8c17095469f326765c0ea01251b47d97.tar.xz
wireguard-openbsd-8d148acd8c17095469f326765c0ea01251b47d97.zip
client_identifier is not a string so using strlen() on it is
inappropriate. Which is why client_identifier_len exists. Replace copy&pasted strlen() with client_identifier_len. Symptoms (crash) and cause (bad c&p) spotted by sthen@. tested & ok sthen@
-rw-r--r--usr.sbin/dhcpd/dhcp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c
index 58c8fb05cbe..85c6c088abb 100644
--- a/usr.sbin/dhcpd/dhcp.c
+++ b/usr.sbin/dhcpd/dhcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp.c,v 1.50 2016/10/10 15:53:36 krw Exp $ */
+/* $OpenBSD: dhcp.c,v 1.51 2016/10/12 13:36:39 krw Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -795,7 +795,7 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer,
/* Replace the lease client identifier with a new one. */
i = DHO_DHCP_CLIENT_IDENTIFIER;
if (packet->options[i].len && lease->client_identifier &&
- (strlen(lease->client_identifier) == packet->options[i].len) &&
+ lease->client_identifier_len == packet->options[i].len &&
!memcmp(lease->client_identifier, packet->options[i].data,
packet->options[i].len)) {
/* Same client identifier. */