"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "common/options.c" between
dhcp-4.3.6.tar.gz and dhcp-4.3.6-P1.tar.gz

About: ISC DHCP implements the "Dynamic Host Configuration Protocols" for connection to a local network. 4.3.x release series.

options.c  (dhcp-4.3.6):options.c  (dhcp-4.3.6-P1)
/* options.c /* options.c
DHCP options parsing and reassembly. */ DHCP options parsing and reassembly. */
/* /*
* Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2018 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies. * copyright notice and this permission notice appear in all copies.
* *
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
skipping to change at line 180 skipping to change at line 180
return 0; return 0;
} }
offset += universe->length_size; offset += universe->length_size;
option_code_hash_lookup(&option, universe->code_hash, &code, option_code_hash_lookup(&option, universe->code_hash, &code,
0, MDL); 0, MDL);
/* If the length is outrageous, the options are bad. */ /* If the length is outrageous, the options are bad. */
if (offset + len > length) { if (offset + len > length) {
/* Avoid reference count overflow */
option_dereference(&option, MDL);
reason = "option length exceeds option buffer length"; reason = "option length exceeds option buffer length";
bogus: bogus:
log_error("parse_option_buffer: malformed option " log_error("parse_option_buffer: malformed option "
"%s.%s (code %u): %s.", universe->name, "%s.%s (code %u): %s.", universe->name,
option ? option->name : "<unknown>", option ? option->name : "<unknown>",
code, reason); code, reason);
buffer_dereference (&bp, MDL); buffer_dereference (&bp, MDL);
return 0; return 0;
} }
skipping to change at line 1760 skipping to change at line 1762
log_error("format_min_length(%s): No safe value " log_error("format_min_length(%s): No safe value "
"for unknown format symbols.", format); "for unknown format symbols.", format);
return INT_MAX; return INT_MAX;
} }
} }
return min_len; return min_len;
} }
/* Format the specified option so that a human can easily read it. */ /* Format the specified option so that a human can easily read it. */
/* Maximum pretty printed size */
#define MAX_OUTPUT_SIZE 32*1024
const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) const char *pretty_print_option (option, data, len, emit_commas, emit_quotes)
struct option *option; struct option *option;
const unsigned char *data; const unsigned char *data;
unsigned len; unsigned len;
int emit_commas; int emit_commas;
int emit_quotes; int emit_quotes;
{ {
static char optbuf [32768]; /* XXX */ /* We add 128 byte pad so we don't have to add checks everywhere. */
static char *endbuf = &optbuf[sizeof(optbuf)]; static char optbuf [MAX_OUTPUT_SIZE + 128]; /* XXX */
static char *endbuf = optbuf + MAX_OUTPUT_SIZE;
int hunksize = 0; int hunksize = 0;
int opthunk = 0; int opthunk = 0;
int hunkinc = 0; int hunkinc = 0;
int numhunk = -1; int numhunk = -1;
int numelem = 0; int numelem = 0;
int count; int count;
int i, j, k, l; int i, j, k, l;
char fmtbuf[32] = ""; char fmtbuf[32] = "";
struct iaddr iaddr; struct iaddr iaddr;
struct enumeration *enumbuf[32]; /* MUST be same as fmtbuf */ struct enumeration *enumbuf[32]; /* MUST be same as fmtbuf */
skipping to change at line 2195 skipping to change at line 2199
break; break;
case 'e': case 'e':
case 'Z': case 'Z':
*op = '\0'; *op = '\0';
break; break;
default: default:
log_error ("Unexpected format code %c", log_error ("Unexpected format code %c",
fmtbuf [j]); fmtbuf [j]);
} }
op += strlen (op); op += strlen (op);
if (op >= endbuf) {
log_error ("Option data exceeds"
" maximum size %d", MAX_OUTPUT_SIZE);
return ("<error>");
}
if (dp == data + len) if (dp == data + len)
break; break;
if (j + 1 < numelem && comma != ':') if (j + 1 < numelem && comma != ':')
*op++ = ' '; *op++ = ' ';
} }
if (i + 1 < numhunk) { if (i + 1 < numhunk) {
*op++ = comma; *op++ = comma;
} }
if (dp == data + len) if (dp == data + len)
break; break;
 End of changes. 5 change blocks. 
4 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)