public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* FYI: fix erroneous `sizeof'
@ 2011-04-28 20:36 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2011-04-28 20:36 UTC (permalink / raw)
  To: Binutils Development

I am checking this in as obvious.

A static analysis tool pointed out this bad `sizeof'.  It seems clear
that the intent is to zero out the whole struct stat, not just the first
word of it.

Tom

2011-04-28  Tom Tromey  <tromey@redhat.com>

	* bfdio.c (memory_bstat): Pass correct size to memset.

Index: bfdio.c
===================================================================
RCS file: /cvs/src/src/bfd/bfdio.c,v
retrieving revision 1.27
diff -u -r1.27 bfdio.c
--- bfdio.c	9 Jun 2010 13:28:31 -0000	1.27
+++ bfdio.c	28 Apr 2011 20:33:17 -0000
@@ -1,7 +1,7 @@
 /* Low-level I/O routines for BFDs.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
    Free Software Foundation, Inc.
 
    Written by Cygnus Support.
@@ -577,7 +577,7 @@
 {
   struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
 
-  memset (statbuf, 0, sizeof (statbuf));
+  memset (statbuf, 0, sizeof (*statbuf));
   statbuf->st_size = bim->size;
 
   return 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-28 20:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-28 20:36 FYI: fix erroneous `sizeof' Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).