Skip to content

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

Open
LamentXU123 wants to merge 1 commit into
php:masterfrom
LamentXU123:reject-NUL
Open

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

Conversation

@LamentXU123

Copy link
Copy Markdown
Contributor

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";
      return true;
  });
 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.

Sign up for free to 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.

1 participant