elfutils/elfutils-old-scanf-fix.diff

28 lines
969 B
Diff

Index: src/addr2line.c
===================================================================
--- src/addr2line.c.orig 2009-04-21 16:50:01.000000000 +0200
+++ src/addr2line.c 2009-08-20 13:11:58.000000000 +0200
@@ -446,11 +446,11 @@ 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')
parsed = adjust_to_section (name, &addr, 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. */
@@ -471,7 +471,6 @@ handle_address (const char *string, Dwfl
}
}
- free (name);
if (!parsed)
return 1;
}