Skip to content

Commit fc02c46

Browse files
committed
Strip null bytes out of GPC input strings
1 parent 906cc47 commit fc02c46

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/gpc_api.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function gpc_get_string( $p_var_name, $p_default = null ) {
111111
trigger_error( ERROR_GPC_ARRAY_UNEXPECTED, ERROR );
112112
}
113113

114-
return $t_result;
114+
return str_replace( "\0","",$t_result );
115115
}
116116

117117
/**
@@ -256,7 +256,11 @@ function gpc_get_string_array( $p_var_name, $p_default = null ) {
256256
trigger_error( ERROR_GPC_ARRAY_EXPECTED, ERROR );
257257
}
258258

259-
return $t_result;
259+
$t_array = array();
260+
foreach( $t_result as $key => $val ) {
261+
$t_array[$key] = str_replace( "\0", "", $val );
262+
}
263+
return $t_array;
260264
}
261265

262266
/**

0 commit comments

Comments
 (0)