From owner-freebsd-bugs@FreeBSD.ORG Fri Jun 12 07:50:01 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 724E6106564A for ; Fri, 12 Jun 2009 07:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4C2808FC17 for ; Fri, 12 Jun 2009 07:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n5C7o1aZ084164 for ; Fri, 12 Jun 2009 07:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n5C7o1ex084163; Fri, 12 Jun 2009 07:50:01 GMT (envelope-from gnats) Resent-Date: Fri, 12 Jun 2009 07:50:01 GMT Resent-Message-Id: <200906120750.n5C7o1ex084163@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Henning Petersen Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3251B106566B for ; Fri, 12 Jun 2009 07:45:55 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 048A58FC0C for ; Fri, 12 Jun 2009 07:45:55 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n5C7jsnA020720 for ; Fri, 12 Jun 2009 07:45:54 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n5C7jsUG020719; Fri, 12 Jun 2009 07:45:54 GMT (envelope-from nobody) Message-Id: <200906120745.n5C7jsUG020719@www.freebsd.org> Date: Fri, 12 Jun 2009 07:45:54 GMT From: Henning Petersen To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/135494: Use of sizeof in dhclinet.c. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jun 2009 07:50:01 -0000 >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: