From f58545dbc2836cd3fdf351babb1304d84fd3e06d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 21 Dec 2014 14:52:17 +0100 Subject: 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 Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Jan 9 23:42:49 CET 2015 on sn-devel-104 --- source3/lib/iov_buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/lib') 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; -- cgit