php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #62190
Patch patch-apc-interned_string.patch revision 2012-05-31 17:29 UTC by cschneid at cschneid dot com

Patch patch-apc-interned_string.patch for APC Bug #62190

Patch version 2012-05-31 17:29 UTC

Return to Bug #62190 | Download this patch
Patch Revisions:

Developer: cschneid@cschneid.com

--- apc_string.c.orig	2012-05-31 18:06:24.989123352 +0200
+++ apc_string.c	2012-05-31 18:11:44.053131928 +0200
@@ -91,17 +91,18 @@
         p = p->pNext;
     }
    
-    if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength) >=
+    if (APCSG(interned_strings_top) + ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1) >=
         APCSG(interned_strings_end)) {
         /* no memory */
         return NULL;
     }
 
     p = (Bucket *) APCSG(interned_strings_top);
-    APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength);
+    APCSG(interned_strings_top) += ZEND_MM_ALIGNED_SIZE(sizeof(Bucket) + nKeyLength + 1);
 
     p->arKey = (char*)(p+1);
     memcpy(p->arKey, arKey, nKeyLength);
+    ((char *)p->arKey)[nKeyLength] = '\0';
     p->nKeyLength = nKeyLength;
     p->h = h;
     p->pData = &p->pDataPtr;
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Sep 30 01:03:48 2022 UTC