-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix socket_recvfrom overflow on buffer size. #16382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
socket_recvfrom overflow on length argument | ||
--EXTENSIONS-- | ||
sockets | ||
--SKIPIF-- | ||
<?php | ||
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') { | ||
die('skip not valid for Windows.'); | ||
} | ||
--FILE-- | ||
<?php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test fails on Windows, also a bit of a weird indentation: normally we don't indent tests outer scope? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes that was just quick copy paste from my local messy test :) |
||
$s = socket_create(AF_UNIX, SOCK_DGRAM, 0); | ||
$buf = $end = ""; | ||
var_dump(socket_recvfrom($s, $buf, PHP_INT_MAX, 0, $end)); | ||
var_dump(socket_recvfrom($s, $buf, -1, 0, $end)); | ||
?> | ||
--EXPECT-- | ||
bool(false) | ||
bool(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code also intended to disallow
ZEND_LONG_MAX-1
, not sure why. I think what you did is fine though.