From owner-freebsd-hackers@FreeBSD.ORG Thu Jan 22 21:11:47 2015 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DBDCD75 for ; Thu, 22 Jan 2015 21:11:47 +0000 (UTC) Received: from elektropost.org (elektropost.org [217.115.13.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 732916BD for ; Thu, 22 Jan 2015 21:11:46 +0000 (UTC) Received: (qmail 74260 invoked from network); 22 Jan 2015 21:11:37 -0000 Received: from elektropost.org (HELO elektropost.org) (erdgeist@erdgeist.org) by elektropost.org with ESMTPS (DHE-RSA-AES128-SHA encrypted); 22 Jan 2015 21:11:37 -0000 Message-ID: <54C16782.2010307@erdgeist.org> Date: Thu, 22 Jan 2015 22:11:30 +0100 From: Dirk Engling User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: FreeBSD Hackers Subject: zero size memset Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jan 2015 21:11:47 -0000 Dear fellow hackers, knowing that the memset API tends to be hard to remember from time to time, I grepped the FreeBSD source for occurences of memset with a length parameter of 0 and a character parameter that should have been a length and found the following: ./contrib/gdb/gdb/remote.c: memset (regs, rs->sizeof_g_packet, 0); ./contrib/gdb/gdb/std-regs.c: memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); ./contrib/gdb/gdb/std-regs.c: memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); ./contrib/gdb/gdb/std-regs.c: memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); Whom to nudge to have this fixed? I also grepped the tree for occurences of x = realloc(x ... but found too many of them to check all instances if they properly abort() when x is NULL. Does anyone know how to exclude false positives here? TIA, erdgeist