SHA256
1
0
forked from pool/elfutils
elfutils/elfutils-old-scanf-fix.diff

31 lines
969 B
Diff

--- src/addr2line.c-dist 2008-12-05 08:42:12.000000000 +0100
+++ src/addr2line.c 2008-12-05 08:45:22.000000000 +0100
@@ -373,8 +373,8 @@ handle_address (const char *string, Dwfl
{
bool parsed = false;
int n;
- char *name = NULL;
- if (sscanf (string, "(%m[^)])%" PRIiMAX "%n", &name, &addr, &n) == 2
+ char name[4096]; /* FIXME */
+ if (sscanf (string, "(%[^)])%" PRIiMAX "%n", name, &addr, &n) == 2
&& string[n] == '\0')
{
/* It was (section)+offset. This makes sense if there is
@@ -415,7 +415,7 @@ handle_address (const char *string, Dwfl
}
}
}
- else if (sscanf (string, "%m[^-+]%" PRIiMAX "%n", &name, &addr, &n) == 2
+ else if (sscanf (string, "%[^-+]%" PRIiMAX "%n", name, &addr, &n) == 2
&& string[n] == '\0')
{
/* It was symbol+offset. */
@@ -436,7 +436,6 @@ handle_address (const char *string, Dwfl
}
}
- free (name);
if (!parsed)
return 1;
}