summaryrefslogtreecommitdiffstats
path: root/f8dd503c70464c6585a2b2a18d7a3457ce9241a4.patch
blob: d1da4bc5b49e9ab114714989dd7ef52618afa9c7 (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
32
33
From f8dd503c70464c6585a2b2a18d7a3457ce9241a4 Mon Sep 17 00:00:00 2001
From: "Christoph M. Becker" <cmbecker69@gmx.de>
Date: Sat, 24 Feb 2018 15:14:03 +0100
Subject: [PATCH] Fix #73434: Null byte at end of array keys in
 getLastResponseInfo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In PHP 7, the terminating NUL has to be excluded from the keys.
Otherwise, the userland developer might even accidentally overwrite the
terminating NUL …
---
 php_oauth.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/php_oauth.h b/php_oauth.h
index 02d68d8..e0ee8cd 100644
--- a/php_oauth.h
+++ b/php_oauth.h
@@ -294,9 +294,9 @@ zend_string *oauth_generate_sig_base(php_so_object *soo, const char *http_method
 	smart_string_free(&(a)->curl_info);
 
 /* this and code that uses it is from ext/curl/interface.c */
-#define CAAL(s, v) add_assoc_long_ex(&info, s, sizeof(s), (long) v);
-#define CAAD(s, v) add_assoc_double_ex(&info, s, sizeof(s), (double) v);
-#define CAAS(s, v) add_assoc_string_ex(&info, s, sizeof(s), (char *) (v ? v : ""));
+#define CAAL(s, v) add_assoc_long_ex(&info, s, sizeof(s) - 1, (long) v);
+#define CAAD(s, v) add_assoc_double_ex(&info, s, sizeof(s) - 1, (double) v);
+#define CAAS(s, v) add_assoc_string_ex(&info, s, sizeof(s) - 1, (char *) (v ? v : ""));
 
 #define ADD_DEBUG_INFO(a, k, s, t) \
 	if(s.len) { \