wp/wp-includes/sodium_compat/src/Compat.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-includes/sodium_compat/src/Compat.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/sodium_compat/src/Compat.php	Tue Sep 27 16:37:53 2022 +0200
@@ -3013,7 +3013,7 @@
     /**
      * DANGER! UNAUTHENTICATED ENCRYPTION!
      *
-     * Unless you are following expert advice, do not used this feature.
+     * Unless you are following expert advice, do not use this feature.
      *
      * Algorithm: XSalsa20
      *
@@ -3112,7 +3112,7 @@
     /**
      * DANGER! UNAUTHENTICATED ENCRYPTION!
      *
-     * Unless you are following expert advice, do not used this feature.
+     * Unless you are following expert advice, do not use this feature.
      *
      * Algorithm: XChaCha20
      *
@@ -3533,9 +3533,13 @@
                 );
             }
         }
+        /** @var positive-int $numBytes */
         if (self::use_fallback('randombytes_buf')) {
             return (string) call_user_func('\\Sodium\\randombytes_buf', $numBytes);
         }
+        if ($numBytes < 0) {
+            throw new SodiumException("Number of bytes must be a positive integer");
+        }
         return random_bytes($numBytes);
     }