Erich Hoover : itss: Enlarge buffer to include space for a concatenated value.
Alexandre Julliard
julliard at winehq.org
Fri Jan 27 11:30:40 CST 2012
Module: wine
Branch: master
Commit: 88f6e898c617c6c4ffc560922c6c19ba9bebe915
URL: http://source.winehq.org/git/wine.git/?a=commit;h=88f6e898c617c6c4ffc560922c6c19ba9bebe915
Author: Erich Hoover <ehoover at mines.edu>
Date: Fri Jan 27 09:48:47 2012 -0700
itss: Enlarge buffer to include space for a concatenated value.
---
dlls/itss/storage.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/itss/storage.c b/dlls/itss/storage.c
index 4f687c6..c53b0c2 100644
--- a/dlls/itss/storage.c
+++ b/dlls/itss/storage.c
@@ -406,7 +406,6 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
IStorage** ppstg)
{
ITSS_IStorageImpl *This = impl_from_IStorage(iface);
- static const WCHAR szRoot[] = { '/', 0 };
struct chmFile *chmfile;
WCHAR *path, *p;
DWORD len;
@@ -418,7 +417,7 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
if( !chmfile )
return E_FAIL;
- len = strlenW( This->dir ) + strlenW( pwcsName ) + 1;
+ len = strlenW( This->dir ) + strlenW( pwcsName ) + 2; /* need room for a terminating slash */
path = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
strcpyW( path, This->dir );
@@ -435,10 +434,12 @@ static HRESULT WINAPI ITSS_IStorageImpl_OpenStorage(
*p = '/';
}
- if(*--p == '/')
+ /* add a terminating slash if one does not already exist */
+ if(*(p-1) != '/')
+ {
+ *p++ = '/';
*p = 0;
-
- strcatW( path, szRoot );
+ }
TRACE("Resolving %s\n", debugstr_w(path));
More information about the wine-cvs
mailing list