summaryrefslogtreecommitdiffstats
path: root/redis-pr1064.patch
blob: 3e43523f6d94a14c62ab6e7a97f5404c6e178bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From 4706aae6eacc62e45cd4280dc5bd80668d22641c Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Fri, 16 Dec 2016 15:31:11 +0100
Subject: [PATCH] Fix #1060 don't return pointer to local volatile data

---
 library.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/library.h b/library.h
index 8eb6708..6aef144 100644
--- a/library.h
+++ b/library.h
@@ -88,7 +88,7 @@ PHP_REDIS_API void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSo
 #if ZEND_MODULE_API_NO >= 20100000
 #define REDIS_DOUBLE_TO_STRING(dbl_str, dbl) do { \
     char dbl_decsep = '.'; \
-    zend_string _zstr = {0}; \
+    static zend_string _zstr = {0}; \
     _zstr.val = _php_math_number_format_ex(dbl, 16, &dbl_decsep, 1, NULL, 0); \
     _zstr.len = strlen(_zstr.val); \
     _zstr.gc = 0x10; \
@@ -96,7 +96,7 @@ PHP_REDIS_API void redis_client_list_reply(INTERNAL_FUNCTION_PARAMETERS, RedisSo
 } while (0);
 #else
 #define REDIS_DOUBLE_TO_STRING(dbl_str, dbl) do { \
-    zend_string _zstr = {0}; \
+    static zend_string _zstr = {0}; \
     _zstr.val = _php_math_number_format(dbl, 16, '.', '\x00'); \
     _zstr.len = strlen(_zstr.val); \
     _zstr.gc = 0x10; \