lwip_recvmsg: MSG_PEEK must be limited to the first iov for TCP

This commit is contained in:
goldsimon 2017-03-11 20:42:59 +01:00
parent 15918d8971
commit cb1a271c61

View File

@ -1144,8 +1144,9 @@ lwip_recvmsg(int s, struct msghdr *message, int flags)
/* sum up received bytes */
ret += recvd_local;
}
if ((recvd_local < 0) || (recvd_local < (int)message->msg_iov[i].iov_len)) {
/* returned prematurely */
if ((recvd_local < 0) || (recvd_local < (int)message->msg_iov[i].iov_len) ||
(flags & MSG_PEEK)) {
/* returned prematurely (or peeking, which might actually be limitated to the first iov) */
if (ret <= 0) {
/* nothing received at all, propagate the error */
ret = recvd_local;