mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-03 15:55:40 +00:00
Check for negative return value of read, write and lseek instead of -1
The return values are used in ways that assume they are positive. In practice, it is not possible to have a negative return value other than -1 due to the size of the buffers being read from or written to. Also add overflow checks when updating the buffer len. Quiets several coverity warnings.
This commit is contained in:
@@ -154,7 +154,7 @@ signal_pipe_cb(int fd, int what, void *v)
|
||||
sudo_debug_printf(SUDO_DEBUG_INFO,
|
||||
"%s: received signal %d", __func__, (int)ch);
|
||||
}
|
||||
if (nread == -1 && errno != EAGAIN) {
|
||||
if (nread < 0 && errno != EAGAIN) {
|
||||
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO|SUDO_DEBUG_ERRNO,
|
||||
"%s: error reading from signal pipe fd %d", __func__, fd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user