rpm/rpm-5.4.5-break-out-of-elf-link-loop.patch
2012-08-01 14:59:23 +04:00

45 lines
1.6 KiB
Diff

--- rpm-5.4.5/lib/rpmds.c.link_loop~ 2012-03-05 22:32:46.858675088 +0100
+++ rpm-5.4.5/lib/rpmds.c 2012-03-06 18:52:18.775950015 +0100
@@ -2938,7 +2938,7 @@ static char * sonameDep(/*@returned@*/ c
return t;
}
-static char *find_elf_interpreter(GElf_Ehdr *ehdr, Elf *elf, char *filename)
+static char *find_elf_interpreter(GElf_Ehdr *ehdr, Elf *elf, char *filename, char *prev)
{
FILE *fp = NULL;
struct stat statbuf;
@@ -3040,6 +3040,8 @@ foo:
char path[MAXPATHLEN] = "";
libpath = elf_strptr (elf, shdr->sh_link, dyn->d_un.d_val);
+ if (prev && *prev && libpath && !strcmp(basename(prev), libpath))
+ libpath = NULL;
if (!libpath || !strlen(libpath))
continue;
@@ -3066,7 +3068,7 @@ foo:
if ((rpath && *rpath) || tmp)
tmp2 = stpcpy(tmp2, ":");
/* XXX: do better check to ensure libraries are all of the same class */
- tmp2 = stpcpy(tmp2, (class == ELFCLASS64) ? "/lib64" : "/lib");
+ tmp2 = stpcpy(tmp2, (class == ELFCLASS64) ? "/lib64:/usr/lib64" : "/lib:/usr/lib");
tmp = buf;
{
int i, count = 1;
@@ -3116,13 +3118,13 @@ end:
fclose(fp);
}
if (!interp_name && libpath)
- return find_elf_interpreter(NULL, NULL, libpath);
+ return find_elf_interpreter(NULL, NULL, libpath, filename);
return interp_name;
}
static int checkuClibc(GElf_Ehdr *ehdr, Elf *elf) {
int ret = 0;
- char *interp = find_elf_interpreter(ehdr, elf, NULL);
+ char *interp = find_elf_interpreter(ehdr, elf, NULL, NULL);
if (interp) {
char *tmp = basename(interp);