[Pkg-privacy-commits] [torsocks] 11/38: Avoid signed/unsigned comparison. Assert bound on size.

Intrigeri intrigeri at moszumanska.debian.org
Thu Jun 23 15:18:23 UTC 2016


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental/master
in repository torsocks.

commit 1e6d4cf8965f696e5d8111379ef56ce7ad8497cf
Author: Taylor R Campbell <campbell+torsocks at mumble.net>
Date:   Tue Jun 16 20:25:59 2015 +0000

    Avoid signed/unsigned comparison. Assert bound on size.
---
 src/common/utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/common/utils.c b/src/common/utils.c
index 377dcae..95ec803 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -22,6 +22,7 @@
 #include <sys/socket.h>
 #include <assert.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -123,6 +124,7 @@ int utils_tokenize_ignore_comments(const char *_line, size_t size, char **tokens
 
 	assert(_line);
 	assert(tokens);
+	assert(size <= INT_MAX);
 
 	line = strdup(_line);
 	if (!line) {
@@ -145,7 +147,7 @@ int utils_tokenize_ignore_comments(const char *_line, size_t size, char **tokens
 		argc++;
 	}
 
-	if (argc > size) {
+	if (argc > (int)size) {
 		ret = -ENOMEM;
 		goto error;
 	}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torsocks.git



More information about the Pkg-privacy-commits mailing list