SHA256
1
0
forked from pool/elfutils
elfutils/elfutils-sizeof-pointer-memaccess.patch
2013-06-19 06:53:06 +00:00

39 lines
1.4 KiB
Diff

Index: elfutils-0.155/src/ar.c
===================================================================
--- elfutils-0.155.orig/src/ar.c
+++ elfutils-0.155/src/ar.c
@@ -461,7 +461,7 @@ do_oper_extract (int oper, const char *a
long int instance)
{
bool found[argc];
- memset (found, '\0', sizeof (found));
+ memset (found, '\0', sizeof (bool) * argc);
size_t name_max = 0;
inline bool should_truncate_fname (void)
@@ -919,7 +919,7 @@ do_oper_delete (const char *arfname, cha
long int instance)
{
bool *found = alloca (sizeof (bool) * argc);
- memset (found, '\0', sizeof (found));
+ memset (found, '\0', sizeof (bool) * argc);
/* List of the files we keep. */
struct armem *to_copy = NULL;
Index: elfutils-0.155/src/nm.c
===================================================================
--- elfutils-0.155.orig/src/nm.c
+++ elfutils-0.155/src/nm.c
@@ -769,8 +769,9 @@ show_symbols_sysv (Ebl *ebl, GElf_Word s
gelf_getshdr (scn, &shdr_mem)->sh_name);
if (unlikely (name == NULL))
{
- name = alloca (sizeof "[invalid sh_name 0x12345678]");
- snprintf (name, sizeof name, "[invalid sh_name %#" PRIx32 "]",
+ size_t len = sizeof "[invalid sh_name 0x12345678]";
+ name = alloca (len);
+ snprintf (name, len, "[invalid sh_name %#" PRIx32 "]",
gelf_getshdr (scn, &shdr_mem)->sh_name);
}
scnnames[elf_ndxscn (scn)] = name;