From: Roy Marples Date: Tue, 13 May 2008 18:39:18 +0000 (+0000) Subject: Move the static buffer off bss. X-Git-Tag: v4.0.2~417 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04407ba2fc70b1582f289dadf8cd3d9d3cbdb7c;p=thirdparty%2Fdhcpcd.git Move the static buffer off bss. --- diff --git a/dhcp.c b/dhcp.c index 338a6690..0bac3aa9 100644 --- a/dhcp.c +++ b/dhcp.c @@ -55,7 +55,7 @@ /* Our aggregate option buffer. * We ONLY use this when options are split, which for most purposes is * practically never. See RFC3396 for details. */ -static uint8_t dhcp_opt_buffer[sizeof(struct dhcp_message)]; +static uint8_t *dhcp_opt_buffer = NULL; struct dhcp_option { uint8_t option; @@ -255,7 +255,9 @@ _get_option(const struct dhcp_message *dhcp, uint8_t opt, int *len, int *type) o = *p++; if (o == opt) { if (op) { - if (!bp) + if (!dhcp_opt_buffer) + dhcp_opt_buffer = xmalloc(sizeof(struct dhcp_message)); + if (!bp) bp = dhcp_opt_buffer; memcpy(bp, op, ol); bp += ol;