summaryrefslogtreecommitdiff
path: root/src/sp_harden_rand.c
diff options
context:
space:
mode:
authorjvoisin2018-01-03 13:36:52 +0100
committerjvoisin2018-01-03 13:36:52 +0100
commit3b547450e5ee6d7bd93f28b44e751ee43936c909 (patch)
treee631724e04d9c125a6a5af163e57ac75a07650cb /src/sp_harden_rand.c
parentbd31eb5fbfbe6c447ebe529232a71f4b2deed9e4 (diff)
Remove some dead code
Diffstat (limited to 'src/sp_harden_rand.c')
-rw-r--r--src/sp_harden_rand.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/sp_harden_rand.c b/src/sp_harden_rand.c
index b84fbe3..3727bef 100644
--- a/src/sp_harden_rand.c
+++ b/src/sp_harden_rand.c
@@ -54,34 +54,26 @@ static void random_int_wrapper(INTERNAL_FUNCTION_PARAMETERS) {
54PHP_FUNCTION(sp_rand) { 54PHP_FUNCTION(sp_rand) {
55 void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS); 55 void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS);
56 56
57 if ((orig_handler = 57 /* call the original `rand` function,
58 zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook), 58 * since we might no be the only ones to hook it*/
59 "rand", strlen("rand")))) { 59 orig_handler =
60 /* call the original `rand` function, 60 zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook),
61 * since we might no be the only ones to hook it*/ 61 "rand", strlen("rand"));
62 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU); 62 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
63 } else { 63
64 sp_log_err("harden_rand",
65 "Unable to find the pointer to the original function 'rand' in "
66 "the hashtable.\n");
67 }
68 random_int_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU); 64 random_int_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU);
69} 65}
70 66
71PHP_FUNCTION(sp_mt_rand) { 67PHP_FUNCTION(sp_mt_rand) {
72 void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS); 68 void (*orig_handler)(INTERNAL_FUNCTION_PARAMETERS);
73 69
74 if ((orig_handler = 70 /* call the original `mt_rand` function,
71 * since we might no be the only ones to hook it*/
72 orig_handler =
75 zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook), 73 zend_hash_str_find_ptr(SNUFFLEUPAGUS_G(sp_internal_functions_hook),
76 "mt_rand", strlen("mt_rand")))) { 74 "mt_rand", strlen("mt_rand"));
77 /* call the original `mt_rand` function, 75 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
78 * since we might no be the only ones to hook it*/ 76
79 orig_handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
80 } else {
81 sp_log_err("harden_rand",
82 "Unable to find the pointer to the original function 'mt_rand' "
83 "in the hashtable.\n");
84 }
85 random_int_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU); 77 random_int_wrapper(INTERNAL_FUNCTION_PARAM_PASSTHRU);
86} 78}
87 79