[Libreoffice-commits] core.git: sal/osl
Tor Lillqvist
tml at iki.fi
Sun Aug 25 21:53:19 PDT 2013
sal/osl/unx/uunxapi.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit d06e5adc21f29c8954021a60445a5c0810731d9e
Author: Tor Lillqvist <tml at iki.fi>
Date: Mon Aug 26 07:41:14 2013 +0300
Be careful not to access a string out of bounds
Change-Id: Ibc43ffa0c535e0baf1bb6d8b213320da345a3d65
diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx
index 3052538..866cef2 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]];
More information about the Libreoffice-commits
mailing list