diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-08-26 07:41:14 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-08-26 07:52:47 +0300 |
commit | d06e5adc21f29c8954021a60445a5c0810731d9e (patch) | |
tree | f5cfb4f836efef2b5021b8aa209f161af71ca902 /sal | |
parent | 3c67751cd57ff54da6afa95949a67011eac5d239 (diff) |
Be careful not to access a string out of bounds
Change-Id: Ibc43ffa0c535e0baf1bb6d8b213320da345a3d65
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/uunxapi.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 3052538f484f..866cef2a8593 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -272,7 +272,8 @@ int open_c(const char *cpPath, int oflag, int mode) // scoped bookmark for it so that we can access the file in // the future, too. (For the "Recent Files" functionality.) const char *sandbox = [NSHomeDirectory() UTF8String]; - if (!(memcmp(sandbox, cpPath, strlen(sandbox)) == 0 && + if (!(strlen(cpPath) > strlen(sandbox) && + memcmp(sandbox, cpPath, strlen(sandbox)) == 0 && cpPath[strlen(sandbox)] == '/')) { NSURL *url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:cpPath]]; |