From: Thomas Veerman Date: Wed, 18 Jul 2012 10:05:50 +0000 (+0000) Subject: PFS: fix negative array index X-Git-Tag: v3.2.1~447 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/invmod.png?a=commitdiff_plain;h=963a10e15afd0247f9dd562c2a4176152c958c7d;p=minix.git PFS: fix negative array index --- diff --git a/servers/pfs/dev_uds.c b/servers/pfs/dev_uds.c index b57e2c657..d5e9a2127 100644 --- a/servers/pfs/dev_uds.c +++ b/servers/pfs/dev_uds.c @@ -551,10 +551,13 @@ static int uds_perform_write(int minor, endpoint_t m_source, break; } } + } - if (peer == -1) { - return ENOENT; - } + if (peer == -1) { + if (pretend) + return SUSPEND; + + return ENOENT; } /* check if write would overrun buffer. check if message @@ -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) || ((uds_fd_table[minor].type == SOCK_SEQPACKET || uds_fd_table[minor].type == SOCK_DGRAM) && - uds_fd_table[peer].size > 0) || (peer == -1)) { + uds_fd_table[peer].size > 0)) { if (pretend) { return SUSPEND;