From 475256713078cbc5bc15c217a28ba839f1ebc37c Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Sun, 11 Aug 2024 22:48:18 +0200 Subject: [PATCH] Fix $boot_length comparison in PhagePHPAgentBootloader Summary: `$boot_length = strlen($boot_sequence->toString())` returns an `int` and `strlen()` expects a `string` as a parameter. Thus calling `if (strlen($boot_length) > 8192)` afterwards to get the string length of an integer makes no sense. Test Plan: Read the code. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Differential Revision: https://we.phorge.it/D25770 --- src/phage/bootloader/PhagePHPAgentBootloader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/phage/bootloader/PhagePHPAgentBootloader.php b/src/phage/bootloader/PhagePHPAgentBootloader.php index e4d522a4..18669b0a 100644 --- a/src/phage/bootloader/PhagePHPAgentBootloader.php +++ b/src/phage/bootloader/PhagePHPAgentBootloader.php @@ -89,7 +89,7 @@ final class PhagePHPAgentBootloader extends PhageAgentBootloader { $boot_length = strlen($boot_sequence->toString()); $boot_sequence->addText($main_sequence->toString()); - if (strlen($boot_length) > 8192) { + if ($boot_length > 8192) { throw new Exception(pht('Stage 1 bootloader is too large!')); }