Skip to content

ext/standard: Reject NUL bytes in dl() - #22358

Merged
LamentXU123 merged 1 commit into
php:masterfrom
LamentXU123:reject-NUL
Jun 18, 2026
Merged

ext/standard: Reject NUL bytes in dl()#22358
LamentXU123 merged 1 commit into
php:masterfrom
LamentXU123:reject-NUL

Conversation

@LamentXU123

Copy link
Copy Markdown
Member

Similar to #21942 and #21871. The dl function in std extension now silently truncates from NUL bytes. That is

<?php$payload = "a\0/bcdefgh";
set_error_handler(function ($severity, $message) {
echo"warning: $message\n";
returntrue;
});
try {
var_dump(dl($payload));
} catch (ValueError$e) {
echo"ValueError: ", $e->getMessage(), "\n";
}

Will return:

warning: dl(): Unable to load dynamic library 'a'

not

warning: dl(): Unable to load dynamic library 'a/bcdefgh'

Reproduce here

This PR rejects parameters containing NUL bytes as we always do in other cases.

@LamentXU123
LamentXU123 merged commit c4c4948 into php:masterJun 18, 2026
48 of 50 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@LamentXU123@Girgias