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 @@ -1545,8 +1545,11 @@ PHP_FUNCTION(socket_recvfrom)
1545
1545
}
1546
1546
1547
1547
#ifdef AF_PACKET
1548
- if (php_sock -> type == AF_PACKET && arg3 < 2048 ) {
1549
- RETURN_FALSE ;
1548
+ // ethernet header + payload
1549
+ // possibly follow-up PR SOCK_DGRAM
1550
+ if (php_sock -> type == AF_PACKET && arg3 < 1514 ) {
1551
+ zend_argument_value_error (3 , "must be at least 1514 for AF_PACKET" );
1552
+ RETURN_THROWS ();
1550
1553
}
1551
1554
#endif
1552
1555
@@ -1782,6 +1785,15 @@ PHP_FUNCTION(socket_sendto)
1782
1785
RETURN_THROWS ();
1783
1786
}
1784
1787
1788
+ #ifdef AF_PACKET
1789
+ // ether header + payload
1790
+ // TODO dealing with SOCK_DGRAM
1791
+ if (php_sock -> type == AF_PACKET && len < 60 ) {
1792
+ zend_argument_value_error (3 , "must be at least 64 for AF_PACKET" );
1793
+ RETURN_THROWS ();
1794
+ }
1795
+ #endif
1796
+
1785
1797
switch (php_sock -> type ) {
1786
1798
case AF_UNIX :
1787
1799
memset (& s_un , 0 , sizeof (s_un ));
You can’t perform that action at this time.
0 commit comments