summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-06-23 07:32:43 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-06-26 23:09:43 -0400
commitd2607e1e4cd361fdcfcbce469d626e94b2095691 (patch)
treeccb6b8a53c09821b6a4a7ea94169340b66a8f872 /doio.c
parent681fb693816658ea30dfe681f34059c8a3acb961 (diff)
downloadperl-d2607e1e4cd361fdcfcbce469d626e94b2095691.tar.gz
msgrcv id can be invalid.
Coverity CID 104825.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index ee93eceac7..2dfd5f4a21 100644
--- a/doio.c
+++ b/doio.c
@@ -2378,7 +2378,12 @@ Perl_do_msgrcv(pTHX_ SV **mark, SV **sp)
mbuf = SvGROW(mstr, sizeof(long)+msize+1);
SETERRNO(0,0);
- ret = msgrcv(id, (struct msgbuf *)mbuf, msize, mtype, flags);
+ if (id >= 0 && msize >= 0 && flags >= 0) {
+ ret = msgrcv(id, (struct msgbuf *)mbuf, msize, mtype, flags);
+ } else {
+ SETERRNO(EINVAL,LIB_INVARG);
+ ret = -1;
+ }
if (ret >= 0) {
SvCUR_set(mstr, sizeof(long)+ret);
*SvEND(mstr) = '\0';