hi! On Mon, Sep 08, 2008 at 09:21:44PM -0400, Nick Bender wrote:indeed, this is ugly... unfortunately this fix contains a failure, because you cannot do sizeof(priority_list) here - it will return the size of the pointer. you cannot actually know the size of the complete array here and it is the uglyness of the dhcpd code itself that it is using a hardcoded size "256" everywhere instead of a) passing passing the output buffer size as well or b) using at least a human-readable define like "#define DHCP_OPTIONS 256". the attached diff would clear the buffer before calling the create_priority_list() function. reyk Index: options.c =================================================================== RCS file: /cvs/src/usr.sbin/dhcpd/options.c,v retrieving revision 1.21 diff -u -p -r1.21 options.c --- options.c 16 Apr 2008 00:36:48 -0000 1.21 +++ options.c 9 Sep 2008 21:15:19 -0000 @@ -207,11 +207,11 @@ void create_priority_list(unsigned char *priority_list, unsigned char *prl, int prl_len) { - int stored_list[256]; + unsigned char stored_list[256]; int i, priority_len = 0; - bzero(stored_list, 256); - bzero(priority_list, 256); + /* clear stored_list, priority_list should be cleared before */ + bzero(&stored_list, sizeof(stored_list)); /* Some options we don't want on the priority list. */ stored_list[DHO_PAD] = 1; @@ -304,6 +304,7 @@ cons_options(struct packet *inpacket, st * list provided in the options. Lacking that use the list provided by * prl. If that is not available just use the default list. */ + bzero(&priority_list, sizeof(priority_list)); if (inpacket && inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data) create_priority_list(priority_list, inpacket->options[DHO_DHCP_PARAMETER_REQUEST_LIST].data,
| Greg KH | Og dreams of kernels |
| Jens Axboe | [PATCH 31/33] Fusion: sg chaining support |
| Arnd Bergmann | Re: finding your own dead "CONFIG_" variables |
| Mark Brown | [PATCH 2/2] Subject: natsemi: Allow users to disable workaround for DspCfg reset |
| Tony Breeds | [LGUEST] Look in object dir for .config |
git: | |
| Brian Downing | Re: Git in a Nutshell guide |
| John Benes | Re: master has some toys |
| Matthias Lederhofer | [PATCH 4/7] introduce GIT_WORK_TREE to specify the work tree |
| Alexander Sulfrian | [RFC/PATCH] RE: git calls SSH_ASKPASS even if DISPLAY is not set |
| Junio C Hamano | Re: Rss produced by git is not valid xml? |
| Linux Kernel Mailing List | iSeries: fix section mismatch in iseries_veth |
| Linux Kernel Mailing List | ixbge: remove TX lock and redo TX accounting. |
| Linux Kernel Mailing List | ixgbe: fix several counter register errata |
| Linux Kernel Mailing List | b43: fix build with CONFIG_SSB_PCIHOST=n |
| Linux Kernel Mailing List | 9p: block-based virtio client |
