Fix reading of uninitilized memory.
Thanks to Felix Weinrank for reporting the issue.
@@ -1154,6 +1154,9 @@ usrsctp_recvv(struct socket *so,
errno = 0;
}
}
+ if (errno != 0) {
+ goto out;
+ }
if ((*msg_flags & MSG_NOTIFICATION) == 0) {
struct sctp_inpcb *inp;
@@ -1205,7 +1208,10 @@ usrsctp_recvv(struct socket *so,
*infolen = 0;
}
}
- if ((fromlenp != NULL) && (fromlen > 0) && (from != NULL)) {
+ if ((fromlenp != NULL) &&
+ (fromlen > 0) &&
+ (from != NULL) &&
+ (ulen > auio.uio_resid)) {
switch (from->sa_family) {
#if defined(INET)
case AF_INET:
@@ -1228,6 +1234,7 @@ usrsctp_recvv(struct socket *so,
*fromlenp = fromlen;
}
}
+out:
if (errno == 0) {
/* ready return value */
return (ulen - auio.uio_resid);
