Skip to content

Commit 779fce7

Browse files
Auto-port 4.1: Epoll: Use correct value to initialize mmsghdr.msg_namelen (#16467)
Auto-port of #16460 to 4.1 Cherry-picked commit: 29a5efc --- Motivation: We did use the incorrect value for the msg_namelen and so could in theory result in an overflow if the kernel really use this value for the last element. Modifications: Use correct value Result: No risk of overflow during recvmmsg Co-authored-by: Norman Maurer <[email protected]>
1 parent 56d84e1 commit 779fce7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

transport-native-epoll/src/main/c/netty_epoll_native.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static jint netty_epoll_native_recvmmsg0(JNIEnv* env, jclass clazz, jint fd, jbo
638638
msg[i].msg_hdr.msg_iovlen = (*env)->GetIntField(env, packet, packetCountFieldId);
639639

640640
msg[i].msg_hdr.msg_name = addr + i;
641-
msg[i].msg_hdr.msg_namelen = (socklen_t) addrSize;
641+
msg[i].msg_hdr.msg_namelen = (socklen_t) storageSize;
642642

643643
if (cntrlbuf != NULL) {
644644
msg[i].msg_hdr.msg_control = cntrlbuf + i * storageSize;

0 commit comments

Comments
 (0)