Skip to content

Commit ff8491c

Browse files
committed
debug payloads..
1 parent 7f1d8ef commit ff8491c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/sockets/sockets.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,21 +1823,21 @@ PHP_FUNCTION(socket_recvfrom)
18231823
break;
18241824
}
18251825
case ETH_P_IPV6: {
1826-
struct php_socket_chunk ip_hdr_buf;
1827-
memcpy(&ip_hdr_buf, &ether_hdr_buf, sizeof(struct php_socket_chunk));
1828-
if (php_socket_get_chunk(&ip_hdr_buf, &raw_buf, ETH_HLEN, sizeof(struct ipv6hdr)) == FAILURE) {
1826+
if (php_socket_get_chunk(&ether_hdr_buf, &raw_buf, ETH_HLEN, sizeof(struct ipv6hdr)) == FAILURE) {
18291827
zval_ptr_dtor(&obj);
18301828
zend_string_efree(recv_buf);
18311829
zend_value_error("invalid ipv6 frame buffer length");
18321830
RETURN_THROWS();
18331831
}
18341832
struct ipv6hdr ip;
18351833
memcpy(&ip, ether_hdr_buf.buf, sizeof(ip));
1834+
struct php_socket_chunk ip_hdr_buf;
1835+
memcpy(&ip_hdr_buf, &ether_hdr_buf, sizeof(struct php_socket_chunk));
18361836
size_t totalip = sizeof(ip) + ip.payload_len;
18371837
if (totalip > ether_hdr_buf.buf_len) {
18381838
zval_ptr_dtor(&obj);
18391839
zend_string_efree(recv_buf);
1840-
zend_value_error("invalid ipv6 payload length");
1840+
zend_value_error("invalid ipv6 payload length %ld %ld", totalip, ether_hdr_buf.buf_len);
18411841
RETURN_THROWS();
18421842
}
18431843
char s[INET6_ADDRSTRLEN], d[INET6_ADDRSTRLEN];

0 commit comments

Comments
 (0)