]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/elf32-avr.c
Fix potential illegal memory access in AVR backend.
[thirdparty/binutils-gdb.git] / bfd / elf32-avr.c
index 7087606c935041836bda6aea226166372e22a717..6d38d1db3af2689faaffb16947a04d7f0406732b 100644 (file)
@@ -3295,10 +3295,10 @@ avr_stub_name (const asection *symbol_section,
 
   len = 8 + 1 + 8 + 1 + 1;
   stub_name = bfd_malloc (len);
-
-  sprintf (stub_name, "%08x+%08x",
-          symbol_section->id & 0xffffffff,
-          (unsigned int) ((rela->r_addend & 0xffffffff) + symbol_offset));
+  if (stub_name != NULL)
+    sprintf (stub_name, "%08x+%08x",
+            symbol_section->id & 0xffffffff,
+            (unsigned int) ((rela->r_addend & 0xffffffff) + symbol_offset));
 
   return stub_name;
 }