From: Peter Hutterer Date: Mon, 25 May 2015 07:27:14 +0000 (+1000) Subject: test: fix coverity complaint about unbounded loop X-Git-Tag: upstream/0.15.0+92+gec468e8~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4be027b90040d04488d1e41bf311ec88e44c555;p=platform%2Fupstream%2Flibinput.git test: fix coverity complaint about unbounded loop buffer tainted (from fgets()) so tighten the loop conditions a bit. Signed-off-by: Peter Hutterer --- diff --git a/test/litest.c b/test/litest.c index 7a4938da..040bfb4a 100644 --- a/test/litest.c +++ b/test/litest.c @@ -82,7 +82,7 @@ litest_backtrace_get_lineno(const char *executable, FILE* f; char buffer[PATH_MAX]; char *s; - int i; + unsigned int i; if (!cwd[0]) getcwd(cwd, sizeof(cwd)); @@ -119,7 +119,7 @@ litest_backtrace_get_lineno(const char *executable, /* now strip cwd from buffer */ s = buffer; i = 0; - while(cwd[i] == *s) { + while(i < strlen(cwd) && *s != '\0' && cwd[i] == *s) { *s = '\0'; s++; i++;