MCPcopy Create free account
hub / github.com/axboe/liburing / io_uring_recvmsg_validate

Function io_uring_recvmsg_validate

src/include/liburing.h:1198–1215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1196}
1197
1198IOURINGINLINE struct io_uring_recvmsg_out *
1199io_uring_recvmsg_validate(void *buf, int buf_len, struct msghdr *msgh)
1200 LIBURING_NOEXCEPT
1201{
1202 unsigned long ulen = (unsigned long)(unsigned int)buf_len;
1203 unsigned long hdr = sizeof(struct io_uring_recvmsg_out);
1204 unsigned long namelen = msgh->msg_namelen;
1205 unsigned long controllen = msgh->msg_controllen;
1206
1207 if (buf_len < 0 || ulen < hdr)
1208 return NULL;
1209 /* check each addition separately to avoid integer overflow */
1210 if (namelen > ulen - hdr)
1211 return NULL;
1212 if (controllen > ulen - hdr - namelen)
1213 return NULL;
1214 return (struct io_uring_recvmsg_out *)buf;
1215}
1216
1217IOURINGINLINE void *io_uring_recvmsg_name(struct io_uring_recvmsg_out *o)
1218 LIBURING_NOEXCEPT

Callers 4

testFunction · 0.85
testFunction · 0.85
test_recvmsg_validateFunction · 0.85
process_cqe_recvFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_recvmsg_validateFunction · 0.68