]> git.p6c8.net - jirafeau/jirafeau.git/commitdiff
Check if ref string is a valid hex string
authorPatrick Canterino <patrick@patrick-canterino.de>
Mon, 12 Oct 2026 13:41:10 +0000 (15:41 +0200)
committerPatrick Canterino <patrick@patrick-canterino.de>
Mon, 12 Oct 2026 13:41:10 +0000 (15:41 +0200)
lib/functions.php

index 6c8d56db6b839b9d7cf6fc786be1d00540587eca..07e5c02f7b3bb7a05667df4d433e2a9b3b6e3075 100644 (file)
@@ -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

patrick-canterino.de