diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-23 07:32:43 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-26 23:09:43 -0400 |
commit | d2607e1e4cd361fdcfcbce469d626e94b2095691 (patch) | |
tree | ccb6b8a53c09821b6a4a7ea94169340b66a8f872 /doio.c | |
parent | 681fb693816658ea30dfe681f34059c8a3acb961 (diff) | |
download | perl-d2607e1e4cd361fdcfcbce469d626e94b2095691.tar.gz |
msgrcv id can be invalid.
Coverity CID 104825.
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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'; |