From 1ffd1d9df3fb47fd6b4b8ffbec12e243a7d7a3c8 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sun, 14 Nov 2010 02:02:32 -0500 Subject: [PATCH] Replace 308 with DHCP_OPTIONS_BUFSIZE in options.c. --- ndhc/options.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ndhc/options.c b/ndhc/options.c index e0722f0..b5c3b2b 100644 --- a/ndhc/options.c +++ b/ndhc/options.c @@ -61,7 +61,7 @@ int option_lengths[] = { /* get an option with bounds checking (warning, not aligned). */ unsigned char *get_option(struct dhcpMessage *packet, int code) { - int i = 0, length = 308; + int i = 0, length = DHCP_OPTIONS_BUFSIZE; unsigned char *optionptr; int over = 0, done = 0, curr = OPTION_FIELD; @@ -116,13 +116,13 @@ int end_option(unsigned char *optionptr) { int i = 0; - while (i < 308 && optionptr[i] != DHCP_END) { + while (i < DHCP_OPTIONS_BUFSIZE && optionptr[i] != DHCP_END) { if (optionptr[i] == DHCP_PADDING) ++i; else i += optionptr[i + OPT_LEN] + 2; } - return (i < 308 ? i : 308); + return (i < DHCP_OPTIONS_BUFSIZE ? i : DHCP_OPTIONS_BUFSIZE); } @@ -133,7 +133,7 @@ int add_option_string(unsigned char *optionptr, unsigned char *string) int end = end_option(optionptr); /* end position + string length + option code/length + end option */ - if (end + string[OPT_LEN] + 2 + 1 >= 308) { + if (end + string[OPT_LEN] + 2 + 1 >= DHCP_OPTIONS_BUFSIZE) { log_error("Option 0x%02x did not fit into the packet!", string[OPT_CODE]); return 0;