[Bug 1507] [PATCH] ldd segfault fix
bugzilla at busybox.net
bugzilla at busybox.net
Fri May 21 09:57:20 UTC 2010
https://bugs.busybox.net/show_bug.cgi?id=1507
--- Comment #4 from Carmelo Amoroso <carmelo.amoroso at st.com> ---
Hi Natanael,
see my comments inline...
diff --git a/utils/ldd.c b/utils/ldd.c
index 1f1dc25..2cd173c 100644
--- a/utils/ldd.c
+++ b/utils/ldd.c
@@ -576,18 +576,20 @@ static struct library *find_elf_interpreter(ElfW(Ehdr)
*ehdr)
}
newlib->name = NULL;
newlib->path = NULL;
- return NULL;
+ break;
>>> I understand the change above ...
}
}
- if (newlib == NULL)
+ if (newlib == NULL) {
newlib = malloc(sizeof(struct library));
+ if (newlib)
+ newlib->next = NULL;
+ }
>>> why this one ? why do you need to initialise the next field...
>>> if !newlib, we returns NULL anyway, so does it matter to set next ?
>>> is this change actually required to fix the segfault you have seen ?
>>> it seems not
if (!newlib)
return NULL;
newlib->name = malloc(strlen(s) + 1);
strcpy(newlib->name, s);
newlib->path = strdup(newlib->name);
newlib->resolved = 1;
- newlib->next = NULL;
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the uClibc-cvs
mailing list