]> granicus.if.org Git - php/commitdiff
- fix lenght for alloc and cpy (Kanwal)
authorPierre Joye <pajoye@php.net>
Tue, 3 Nov 2009 10:48:12 +0000 (10:48 +0000)
committerPierre Joye <pajoye@php.net>
Tue, 3 Nov 2009 10:48:12 +0000 (10:48 +0000)
TSRM/tsrm_win32.c

index 44f6495d5847615f89b3d212636d373a48f8e0fc..229ff23fe77a539e4471680e03f23a47bd2ccad8 100644 (file)
@@ -111,7 +111,7 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
        char *bucket_key = NULL;
 
        if (!pSid) {
-               bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname));
+               bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + 1);
                if (!bucket_key) {
                        return NULL;
                }
@@ -123,14 +123,14 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
                return NULL;
        }
 
-       bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + strlen(ptcSid));
+       bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + strlen(ptcSid) + 1);
        if (!bucket_key) {
                LocalFree(ptcSid);
                return NULL;
        }
 
        memcpy(bucket_key, ptcSid, strlen(ptcSid));
-       memcpy(bucket_key + strlen(ptcSid), pathname, strlen(pathname));
+       memcpy(bucket_key + strlen(ptcSid), pathname, strlen(pathname) + 1);
 
        LocalFree(ptcSid);
        return bucket_key;