1 diff -Naur glibc-2.3.6.org/elf/dl-load.c glibc-2.3.6/elf/dl-load.c
2 --- glibc-2.3.6.org/elf/dl-load.c 2005-04-06 04:50:10.000000000 +0200
3 +++ glibc-2.3.6/elf/dl-load.c 2010-10-19 17:41:09.000000000 +0200
8 -is_dst (const char *start, const char *name, const char *str,
9 - int is_path, int secure)
10 +is_dst (const char *start, const char *name, const char *str, int is_path)
13 bool is_curly = false;
15 && (!is_path || name[len] != ':'))
18 - if (__builtin_expect (secure, 0)
19 - && ((name[len] != '\0' && (!is_path || name[len] != ':'))
20 - || (name != start + 1 && (!is_path || name[-2] != ':'))))
30 - /* $ORIGIN is not expanded for SUID/GUID programs (except if it
31 - is $ORIGIN alone) and it must always appear first in path. */
32 + /* $ORIGIN is not expanded for SUID/GUID programs. */
34 - if ((len = is_dst (start, name, "ORIGIN", is_path,
35 - INTUSE(__libc_enable_secure))) != 0
36 - || (len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0
37 - || (len = is_dst (start, name, "LIB", is_path, 0)) != 0)
38 + if (((len = is_dst (start, name, "ORIGIN", is_path)) != 0
39 + && !INTUSE(__libc_enable_secure))
40 + || (len = is_dst (start, name, "PLATFORM", is_path)) != 0
41 + || (len = is_dst (start, name, "LIB", is_path)) != 0)
44 name = strchr (name + len, '$');
49 - if ((len = is_dst (start, name, "ORIGIN", is_path,
50 - INTUSE(__libc_enable_secure))) != 0)
52 - else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
53 + if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0)
55 + // Ignore this path at SUID/GUID
56 + if (INTUSE(__libc_enable_secure))
57 + repl = (const char *) -1;
61 + else if ((len = is_dst (start, name, "PLATFORM", is_path)) != 0)
62 repl = GLRO(dl_platform);
63 - else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
64 + else if ((len = is_dst (start, name, "LIB", is_path)) != 0)
67 if (repl != NULL && repl != (const char *) -1)