]> git.p6c8.net - jirafeau/jirafeau.git/blobdiff - script.php
More validation of async ref and code strings
[jirafeau/jirafeau.git] / script.php
index aa8c259fe2ce6597ac0b52ec0d7ceec3aa542894..2fc297f3412302a0933ef91d3d85f82560c49df9 100644 (file)
@@ -74,7 +74,7 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES)
             !jirafeau_challenge_upload($cfg, get_ip_address($cfg), $_POST['upload_password'])) {
             echo 'Error 3: Invalid password';
             exit;
-        } elseif (!jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
+        } elseif (!isset($_POST['upload_password']) && !jirafeau_challenge_upload($cfg, get_ip_address($cfg), null)) {
             echo 'Error 2: No password nor allowed IP';
             exit;
         }
@@ -163,7 +163,7 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES)
         $d = $_GET['d'];
     }
 
-    if (!preg_match('/[0-9a-zA-Z_-]+$/', $link_name)) {
+    if (!preg_match('/^[0-9a-zA-Z_-]+$/', $link_name)) {
         echo 'Error 7';
         exit;
     }
@@ -183,7 +183,7 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES)
         echo 'Error 9';
         exit;
     }
-    if (strlen($link['key']) > 0 && md5($key) != $link['key']) {
+    if (strlen($link['key']) > 0 && hash('sha256', $key) != $link['key']) {
         sleep(2);
         echo 'Error 10';
         exit;

patrick-canterino.de