Skip to content

Commit f8dd503

Browse files
cmb69remicollet
authored andcommitted
Fix #73434: Null byte at end of array keys in getLastResponseInfo
In PHP 7, the terminating NUL has to be excluded from the keys. Otherwise, the userland developer might even accidentally overwrite the terminating NUL …
1 parent 454daa4 commit f8dd503

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

php_oauth.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ zend_string *oauth_generate_sig_base(php_so_object *soo, const char *http_method
294294
smart_string_free(&(a)->curl_info);
295295

296296
/* this and code that uses it is from ext/curl/interface.c */
297-
#define CAAL(s, v) add_assoc_long_ex(&info, s, sizeof(s), (long) v);
298-
#define CAAD(s, v) add_assoc_double_ex(&info, s, sizeof(s), (double) v);
299-
#define CAAS(s, v) add_assoc_string_ex(&info, s, sizeof(s), (char *) (v ? v : ""));
297+
#define CAAL(s, v) add_assoc_long_ex(&info, s, sizeof(s) - 1, (long) v);
298+
#define CAAD(s, v) add_assoc_double_ex(&info, s, sizeof(s) - 1, (double) v);
299+
#define CAAS(s, v) add_assoc_string_ex(&info, s, sizeof(s) - 1, (char *) (v ? v : ""));
300300

301301
#define ADD_DEBUG_INFO(a, k, s, t) \
302302
if(s.len) { \

0 commit comments

Comments
 (0)