Skip to content

Commit

Permalink
i#2051: in frontend, check for execute not read of DR root dir (#2389)
Browse files Browse the repository at this point in the history
Adds a new static function file_is_executable in frontend.c to check for execute not read of DR root dir.

Fixes #2051
  • Loading branch information
jwysowski authored Mar 10, 2021
1 parent c5bbe93 commit a8c9721
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drmemory/frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ file_is_readable(char *path)
return (drfront_access(path, DRFRONT_READ, &ret) == DRFRONT_SUCCESS && ret);
}

static bool
file_is_executable(char *path)
{
bool ret = false;
return (drfront_access(path, DRFRONT_EXEC, &ret) == DRFRONT_SUCCESS && ret);
}

static void
get_absolute_path(const char *src, char *buf, size_t buflen/*# elements*/)
{
Expand Down Expand Up @@ -1297,7 +1304,7 @@ _tmain(int argc, TCHAR *targv[])
}
}

if (!file_is_readable(dr_root)) {
if (!file_is_executable(dr_root)) {
fatal("invalid -dr_root %s", dr_root);
goto error; /* actually won't get here */
}
Expand Down

0 comments on commit a8c9721

Please sign in to comment.