File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1547,8 +1547,11 @@ PHP_FUNCTION(socket_recvfrom)
1547
1547
}
1548
1548
1549
1549
#ifdef AF_PACKET
1550
- if (php_sock -> type == AF_PACKET && arg3 < 2048 ) {
1551
- RETURN_FALSE ;
1550
+ // ethernet header + payload
1551
+ // possibly follow-up PR SOCK_DGRAM
1552
+ if (php_sock -> type == AF_PACKET && arg3 < 1514 ) {
1553
+ zend_argument_value_error (3 , "must be at least 1514 for AF_PACKET" );
1554
+ RETURN_THROWS ();
1552
1555
}
1553
1556
#endif
1554
1557
@@ -1783,6 +1786,15 @@ PHP_FUNCTION(socket_sendto)
1783
1786
RETURN_THROWS ();
1784
1787
}
1785
1788
1789
+ #ifdef AF_PACKET
1790
+ // ether header + payload
1791
+ // TODO dealing with SOCK_DGRAM
1792
+ if (php_sock -> type == AF_PACKET && len < 60 ) {
1793
+ zend_argument_value_error (3 , "must be at least 64 for AF_PACKET" );
1794
+ RETURN_THROWS ();
1795
+ }
1796
+ #endif
1797
+
1786
1798
switch (php_sock -> type ) {
1787
1799
case AF_UNIX :
1788
1800
memset (& s_un , 0 , sizeof (s_un ));
You can’t perform that action at this time.
0 commit comments