]> git.p6c8.net - jirafeau/pcanterino.git/commitdiff
Fixes for issues #31 and #32
authorPatrick Canterino <patrick@patrick-canterino.de>
Thu, 19 Jun 2025 11:56:59 +0000 (13:56 +0200)
committerPatrick Canterino <patrick@patrick-canterino.de>
Thu, 19 Jun 2025 11:56:59 +0000 (13:56 +0200)
See merge request jirafeau/Jirafeau!22

admin.php
f.php
lib/functions.php

index f8270a28d3bef505f8888b1de17483d8cf780f1c..75cc38d66eb09100e3cdcd067bef00c0f98f7d6e 100644 (file)
--- a/admin.php
+++ b/admin.php
@@ -73,7 +73,7 @@ elseif (true === jirafeau_challenge_admin_ip($cfg, get_ip_address($cfg))) {
         }
         /* Test web password authentication. */
         elseif (!empty($cfg['admin_password']) && isset($_POST['admin_password'])) {
-            if ($cfg['admin_password'] === hash('sha256', $_POST['admin_password'])) {
+            if (hash_equals($cfg['admin_password'], hash('sha256', $_POST['admin_password']))) {
                 jirafeau_admin_session_start();
             } else {
                 require(JIRAFEAU_ROOT . 'lib/template/header.php');
diff --git a/f.php b/f.php
index f523f728a2e57f0dfc75498a40315283033d0d8e..a93ec981949aed82ac2173f64918432119bd44fb 100644 (file)
--- a/f.php
+++ b/f.php
@@ -171,7 +171,7 @@ if (!empty($link['key'])) {
         require(JIRAFEAU_ROOT.'lib/template/footer.php');
         exit;
     } else {
-        if ($link['key'] == md5($_POST['key'])) {
+        if (hash_equals($link['key'], md5($_POST['key']))) {
             $password_challenged = true;
         } else {
             sleep(2);
index 7ac4c9e3f4eb18fb27c2e443131e339b1cf54227..f9fbd9b72a92d79fa24e883db6f470bd30cb998a 100644 (file)
@@ -623,7 +623,7 @@ function jirafeau_is_viewable($mime)
     if (!empty($mime)) {
         $viewable = array('image', 'video', 'audio');
         $decomposed = explode('/', $mime);
-        if (in_array($decomposed[0], $viewable) && stripos($mime, 'image/svg+xml') === false) {
+        if (in_array($decomposed[0], $viewable) && stripos($mime, 'image/svg+xml') === false && strpos($mime, ',') === false) {
             return true;
         }
         $viewable = array('text/plain');

patrick-canterino.de