diff --git a/annocheck/hardened.c b/annocheck/hardened.c index 604b6a1..deeb084 100644 --- a/annocheck/hardened.c +++ b/annocheck/hardened.c @@ -1895,30 +1895,32 @@ is_special_glibc_binary (annocheck_data * data) return true; } - /* If we are testing an uninstalled rpm then the paths will start with "." - so skip this. */ + /* If we are testing an uninstalled rpm then the paths will probably + start with "." so skip this. */ if (path[0] == '.') ++path; - if (path[0] == '/') + ++path; + /* Look for absolute paths to known glibc install locations. + If found, strip the prefix. + This allows us to cope with symbolic links and 32-bit/64-bit multilibs. */ + if (strchr (path, '/')) { - /* If the path is absolute, then strip the prefix. - This allows us to cope with symbolic links and 32-bit/64-bit multilibs. */ static const char * known_prefixes [] = { /* NB/ The terminating forward slash is important. */ - "/lib/", - "/lib64/", - "/sbin/", - "/usr/bin/", - "/usr/lib/", - "/usr/lib/gconv/", - "/usr/lib64/", - "/usr/lib64/gconv/", - "/usr/lib64/glibc-hwcaps/power10/", - "/usr/libexec/", - "/usr/libexec/getconf/", - "/usr/sbin/" + "lib/", + "lib64/", + "sbin/", + "usr/bin/", + "usr/lib/", + "usr/lib/gconv/", + "usr/lib64/", + "usr/lib64/gconv/", + "usr/lib64/glibc-hwcaps/power10/", + "usr/libexec/", + "usr/libexec/getconf/", + "usr/sbin/" }; for (i = ARRAY_SIZE (known_prefixes); i--;)