public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] linker.c, null string
@ 2007-07-24 22:19 msnyder
  2007-07-25  0:11 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: msnyder @ 2007-07-24 22:19 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 134 bytes --]

Shouldn't use NULL to denote an invalid string, because the pointer
will be passed to functions that will dereference it (Coverity).


[-- Attachment #2: string.txt --]
[-- Type: text/plain, Size: 830 bytes --]

2007-07-24  Michael Snyder  <msnyder@access-company.com>

	* linker.c (generic_link_add_symbol_list): Use an invalid string
	rather than null, since the pointer will be dereferenced.

Index: linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.59
diff -p -r1.59 linker.c
*** linker.c	3 Jul 2007 14:26:42 -0000	1.59
--- linker.c	24 Jul 2007 20:53:38 -0000
*************** generic_link_add_symbol_list (bfd *abfd,
*** 1334,1340 ****
  	      name = bfd_asymbol_name (*pp);
  	    }
  	  else
! 	    string = NULL;
  
  	  bh = NULL;
  	  if (! (_bfd_generic_link_add_one_symbol
--- 1334,1340 ----
  	      name = bfd_asymbol_name (*pp);
  	    }
  	  else
! 	    string = "*invalid*";
  
  	  bh = NULL;
  	  if (! (_bfd_generic_link_add_one_symbol

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-25  0:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-24 22:19 [PATCH] linker.c, null string msnyder
2007-07-25  0:11 ` Alan Modra
2007-07-25  0:49   ` msnyder

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).