Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: sandbox/linux/seccomp/sandbox.cc

Issue 652188: Be more restrictive when finding file names for libraries that need patching.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/seccomp/sandbox.cc
===================================================================
--- sandbox/linux/seccomp/sandbox.cc (revision 39795)
+++ sandbox/linux/seccomp/sandbox.cc (working copy)
@@ -474,9 +474,24 @@
// Intercept system calls in libraries that are known to have them.
for (Maps::const_iterator iter = maps.begin(); iter != maps.end(); ++iter){
Library* library = *iter;
+ const char* mapping = iter.name().c_str();
+
+ // Find the actual base name of the mapped library by skipping past any
+ // SPC and forward-slashes. We don't want to accidentally find matches,
+ // because the directory name included part of our well-known lib names.
+ //
+ // Typically, prior to pruning, entries would look something like this:
+ // 08:01 2289011 /lib/libc-2.7.so
Markus (顧孟勤) 2010/02/24 01:43:08 Is this better? I hope this makes sense now.
agl 2010/02/24 01:58:16 Oh, yea. I just had the path in mind. Makes sense
Markus (顧孟勤) 2010/02/24 02:02:11 It's explicitly supposed to be able to deal with s
agl 2010/02/24 02:04:23 No I'm just a muppet. You should commit this befor
+ for (const char *delim = " /"; *delim; ++delim) {
+ const char* skip = strrchr(mapping, *delim);
+ if (skip) {
+ mapping = skip + 1;
+ }
+ }
+
for (const char **ptr = libs; *ptr; ptr++) {
- const char *name = strstr(iter.name().c_str(), *ptr);
- if (name) {
+ const char *name = strstr(mapping, *ptr);
+ if (name == mapping) {
char ch = name[strlen(*ptr)];
if (ch < 'A' || (ch > 'Z' && ch < 'a') || ch > 'z') {
if (library->parseElf()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698