diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-25 08:56:59 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-06-26 23:09:42 -0400 |
commit | 66cf59b41651877e331f15ffe05c835d98934479 (patch) | |
tree | 31c238b296e48b40291946059568f71141d2297f /ext/POSIX/POSIX.xs | |
parent | 8481e3d3f84153184492af64627d21f391587c61 (diff) | |
download | perl-66cf59b41651877e331f15ffe05c835d98934479.tar.gz |
tcsetattr optional_actions can be invalid.
Coverity CID 104815.
Diffstat (limited to 'ext/POSIX/POSIX.xs')
-rw-r--r-- | ext/POSIX/POSIX.xs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index ba986bb8f0..216c47e860 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1958,7 +1958,12 @@ setattr(termios_ref, fd = 0, optional_actions = DEF_SETATTR_ACTION) it a useful default. 0 isn't valid on all operating systems - on Solaris (at least) TCSANOW, TCSADRAIN and TCSAFLUSH have the same values as the equivalent ioctls, TCSETS, TCSETSW and TCSETSF. */ - RETVAL = tcsetattr(fd, optional_actions, termios_ref); + if (optional_actions < 0) { + SETERRNO(EINVAL, LIB_INVARG); + RETVAL = -1; + } else { + RETVAL = tcsetattr(fd, optional_actions, termios_ref); + } } else { SETERRNO(EBADF,RMS_IFI); RETVAL = -1; |