From: Roy Marples Date: Thu, 16 Jan 2014 09:29:42 +0000 (+0000) Subject: Fix an off-by-1 error decoding RFC3361. X-Git-Tag: v6.3.0~108 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b9a11db11c86ada12e7f1677a8bf6e791cd2624c;p=thirdparty%2Fdhcpcd.git Fix an off-by-1 error decoding RFC3361. We can use RFC3361 to decode the RFC3495 TSP sub option 3. This means that RFC3495 is now fully supported. --- diff --git a/dhcp-common.c b/dhcp-common.c index 4715b61e..c8db0738 100644 --- a/dhcp-common.c +++ b/dhcp-common.c @@ -390,7 +390,7 @@ print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data, if ((tmp = decode_rfc3361(dl, data)) == NULL) return -1; l = strlen(tmp); - l = print_string(s, len, l - 1, (uint8_t *)tmp); + l = print_string(s, len, l, (uint8_t *)tmp); free(tmp); return l; } diff --git a/dhcpcd-definitions.conf b/dhcpcd-definitions.conf index 623aa5f1..9fdfb146 100644 --- a/dhcpcd-definitions.conf +++ b/dhcpcd-definitions.conf @@ -135,15 +135,7 @@ define 120 rfc3361 sip_server define 122 encap tsp encap 1 ipaddress dhcp_server encap 2 ipaddress dhcp_secondary_server -encap 3 embed provisioning_server -embed byte type -embed domain fqdn -#embed ipaddress address -# We only support FQDN in option 3 out of the box which is type 0. -# Type 1 is an ipaddress, but we currently have no logic to change embedded -# type based on the content of an option. -# To swap it out, just comment / uncomment the above two lines to your liking. -# However, ensure that only one is uncommented. +encap 3 rfc3361 provisioning_server encap 4 embed as_req_as_rep_backoff embed uint32 nominal embed uint32 maximum