pajoye                                   Tue, 03 Nov 2009 10:48:12 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=290166

Log:
- fix lenght for alloc and cpy (Kanwal)

Changed paths:
    U   php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c
    U   php/php-src/branches/PHP_5_3_1/TSRM/tsrm_win32.c
    U   php/php-src/trunk/TSRM/tsrm_win32.c

Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c      2009-11-03 05:16:21 UTC 
(rev 290165)
+++ php/php-src/branches/PHP_5_3/TSRM/tsrm_win32.c      2009-11-03 10:48:12 UTC 
(rev 290166)
@@ -111,7 +111,7 @@
        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 @@
                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;

Modified: php/php-src/branches/PHP_5_3_1/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/branches/PHP_5_3_1/TSRM/tsrm_win32.c    2009-11-03 05:16:21 UTC 
(rev 290165)
+++ php/php-src/branches/PHP_5_3_1/TSRM/tsrm_win32.c    2009-11-03 10:48:12 UTC 
(rev 290166)
@@ -111,7 +111,7 @@
        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 @@
                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;

Modified: php/php-src/trunk/TSRM/tsrm_win32.c
===================================================================
--- php/php-src/trunk/TSRM/tsrm_win32.c 2009-11-03 05:16:21 UTC (rev 290165)
+++ php/php-src/trunk/TSRM/tsrm_win32.c 2009-11-03 10:48:12 UTC (rev 290166)
@@ -111,7 +111,7 @@
        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 @@
                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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to