Date: Fri, 12 Jun 2009 07:45:54 GMT From: Henning Petersen <henning.petersen@t-online.de> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/135494: Use of sizeof in dhclinet.c. Message-ID: <200906120745.n5C7jsUG020719@www.freebsd.org> Resent-Message-ID: <200906120750.n5C7o1ex084163@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 135494 >Category: bin >Synopsis: Use of sizeof in dhclinet.c. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 12 07:50:00 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Henning Petersen >Release: FreeBSD-current >Organization: none >Environment: >Description: Use of sizeof(options) in dhclient.c . >How-To-Repeat: >Fix: RCS file: /home/ncvs/src/sbin/dhclient/dhclient.c,v retrieving revision 1.25 diff -u -r1.25 dhclient.c --- dhclient.c 17 Oct 2008 13:28:53 -0000 1.25 +++ dhclient.c 12 Jun 2009 07:26:25 -0000 @@ -1433,7 +1433,7 @@ int i; memset(option_elements, 0, sizeof(option_elements)); - memset(options, 0, sizeof(options)); + memset(options, 0, sizeof(*options)); memset(&ip->client->packet, 0, sizeof(ip->client->packet)); /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */ @@ -1546,7 +1546,7 @@ struct tree_cache option_elements[256]; int i; - memset(options, 0, sizeof(options)); + memset(options, 0, sizeof(*options)); memset(&ip->client->packet, 0, sizeof(ip->client->packet)); /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */ @@ -1681,7 +1681,7 @@ unsigned char decline = DHCPDECLINE; int i; - memset(options, 0, sizeof(options)); + memset(options, 0, sizeof(*options)); memset(&ip->client->packet, 0, sizeof(ip->client->packet)); /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */ Patch attached with submission follows: RCS file: /home/ncvs/src/sbin/dhclient/dhclient.c,v retrieving revision 1.25 diff -u -r1.25 dhclient.c --- dhclient.c 17 Oct 2008 13:28:53 -0000 1.25 +++ dhclient.c 12 Jun 2009 07:26:25 -0000 @@ -1433,7 +1433,7 @@ int i; memset(option_elements, 0, sizeof(option_elements)); - memset(options, 0, sizeof(options)); + memset(options, 0, sizeof(*options)); memset(&ip->client->packet, 0, sizeof(ip->client->packet)); /* Set DHCP_MESSAGE_TYPE to DHCPDISCOVER */ @@ -1546,7 +1546,7 @@ struct tree_cache option_elements[256]; int i; - memset(options, 0, sizeof(options)); + memset(options, 0, sizeof(*options)); memset(&ip->client->packet, 0, sizeof(ip->client->packet)); /* Set DHCP_MESSAGE_TYPE to DHCPREQUEST */ @@ -1681,7 +1681,7 @@ unsigned char decline = DHCPDECLINE; int i; - memset(options, 0, sizeof(options)); + memset(options, 0, sizeof(*options)); memset(&ip->client->packet, 0, sizeof(ip->client->packet)); /* Set DHCP_MESSAGE_TYPE to DHCPDECLINE */ >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906120745.n5C7jsUG020719>