From 46c13b35d0d5c98eb189c6f9b861142f0b999488 Mon Sep 17 00:00:00 2001 From: wizzwizz4 <12433834+wizzwizz4@users.noreply.github.com> Date: Wed, 26 Feb 2020 20:43:50 +0000 Subject: [PATCH] Fix format string vulnerability (fixes #5) --- src/zend/methods.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zend/methods.rs b/src/zend/methods.rs index ac33f11..7162bc0 100644 --- a/src/zend/methods.rs +++ b/src/zend/methods.rs @@ -9,7 +9,7 @@ use std::ffi::CString; pub fn php_echo(message: &str) { let c_message = CString::new(message).unwrap(); unsafe { - php_printf(c_message.as_bytes_with_nul().as_ptr() as *const i8); + php_printf(c_str!("%s"), c_message.as_bytes_with_nul().as_ptr() as *const i8); } } @@ -188,4 +188,4 @@ fn add_zend_value_to_zval(value: ZendValue, zval: &mut Zval) { zval.type_info = zval_from_value.type_info; zval.u2 = zval_from_value.u2; } -} \ No newline at end of file +}