diff options
author | Volker Lendecke <vl@samba.org> | 2014-12-21 14:52:17 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-01-09 23:42:49 +0100 |
commit | f58545dbc2836cd3fdf351babb1304d84fd3e06d (patch) | |
tree | f80f571b6f2c92592dbd19879c6fbe1f86afa604 /source3/lib/iov_buf.c | |
parent | 0e26e0f6f6b7d657fdd51202f5919328278824e6 (diff) | |
download | samba-f58545dbc2836cd3fdf351babb1304d84fd3e06d.tar.gz samba-f58545dbc2836cd3fdf351babb1304d84fd3e06d.tar.xz samba-f58545dbc2836cd3fdf351babb1304d84fd3e06d.zip |
lib: Simplify iov_buf
According to
https://www.securecoding.cert.org/confluence/display/seccode/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap
we only need to check against one operand.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 9 23:42:49 CET 2015 on sn-devel-104
Diffstat (limited to 'source3/lib/iov_buf.c')
-rw-r--r-- | source3/lib/iov_buf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source3/lib/iov_buf.c b/source3/lib/iov_buf.c index f0e05a64da..82a4af5323 100644 --- a/source3/lib/iov_buf.c +++ b/source3/lib/iov_buf.c @@ -39,8 +39,8 @@ ssize_t iov_buf(const struct iovec *iov, int iovcnt, tmp = needed + thislen; - if ((tmp < needed) || (tmp < thislen)) { - /* overflow */ + if (tmp < needed) { + /* wrap */ return -1; } needed = tmp; |