From: Patrick Canterino Date: Mon, 12 Oct 2026 13:41:10 +0000 (+0200) Subject: Check if ref string is a valid hex string X-Git-Tag: 4.8.0~5^2~4 X-Git-Url: https://git.p6c8.net/jirafeau/pcanterino.git/commitdiff_plain/1743a72ce35f4812019bad5a12eecd0062f130b5?ds=inline Check if ref string is a valid hex string --- diff --git a/lib/functions.php b/lib/functions.php index 6c8d56d..07e5c02 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1120,6 +1120,11 @@ function jirafeau_async_init($filename, $type, $one_time, $key, $time, $ip) */ function jirafeau_async_push($ref, $data, $code, $max_file_size) { + /* Validate ref string. */ + if (!ctype_xdigit(trim($ref))) { + return "Error: Malformed ref string"; + } + /* Get async infos. */ $a = jirafeau_get_async_ref($ref); @@ -1193,6 +1198,11 @@ function jirafeau_async_push($ref, $data, $code, $max_file_size) */ function jirafeau_async_end($ref, $code, $crypt, $link_name_length, $file_hash_method) { + /* Validate ref string. */ + if (!ctype_xdigit(trim($ref))) { + return "Error: Malformed ref string"; + } + /* Get async infos. */ $a = jirafeau_get_async_ref($ref); if (count($a) == 0