PFS: fix negative array index

This commit is contained in:
Thomas Veerman 2012-07-18 10:05:50 +00:00
parent 0d3ccd8908
commit 963a10e15a

View file

@ -551,11 +551,14 @@ static int uds_perform_write(int minor, endpoint_t m_source,
break; break;
} }
} }
}
if (peer == -1) { if (peer == -1) {
if (pretend)
return SUSPEND;
return ENOENT; return ENOENT;
} }
}
/* check if write would overrun buffer. check if message /* check if write would overrun buffer. check if message
* boundry preserving types (SEQPACKET and DGRAM) wouldn't write * boundry preserving types (SEQPACKET and DGRAM) wouldn't write
@ -565,7 +568,7 @@ static int uds_perform_write(int minor, endpoint_t m_source,
if ((uds_fd_table[peer].pos+uds_fd_table[peer].size+size > PIPE_BUF) || if ((uds_fd_table[peer].pos+uds_fd_table[peer].size+size > PIPE_BUF) ||
((uds_fd_table[minor].type == SOCK_SEQPACKET || ((uds_fd_table[minor].type == SOCK_SEQPACKET ||
uds_fd_table[minor].type == SOCK_DGRAM) && uds_fd_table[minor].type == SOCK_DGRAM) &&
uds_fd_table[peer].size > 0) || (peer == -1)) { uds_fd_table[peer].size > 0)) {
if (pretend) { if (pretend) {
return SUSPEND; return SUSPEND;