bfd/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 11 Feb 2012 15:10:12 +0000 (15:10 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 11 Feb 2012 15:10:12 +0000 (15:10 +0000)
* oasys.c (oasys_write_header): Fix compilation warning on zero-sized
memset.

bfd/ChangeLog
bfd/oasys.c

index 1f8f30e..f2e40dd 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
+           Nick Clifton  <nickc@redhat.com>
+
+       * oasys.c (oasys_write_header): Fix compilation warning on zero-sized
+       memset.
+
 2012-02-10  Iain Sandoe  <idsandoe@googlemail.com>
 
        * mach-o.c (bfd_mach_o_build_seg_command): Count zerofill section
index 11d2440..ebb12e8 100644 (file)
@@ -906,9 +906,11 @@ oasys_write_header (bfd *abfd)
 
   if (length > (size_t) sizeof (r.module_name))
     length = sizeof (r.module_name);
+  else if (length < (size_t) sizeof (r.module_name))
+    (void) memset (r.module_name + length, ' ',
+                  sizeof (r.module_name) - length);
 
   (void) memcpy (r.module_name, abfd->filename, length);
-  (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length);
 
   r.version_number = OASYS_VERSION_NUMBER;
   r.rev_number = OASYS_REV_NUMBER;