projects
/
platform
/
upstream
/
libinput.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d9f7029
)
test: fix coverity complaint about unbounded loop
author
Peter Hutterer
<peter.hutterer@who-t.net>
Mon, 25 May 2015 07:27:14 +0000
(17:27 +1000)
committer
Peter Hutterer
<peter.hutterer@who-t.net>
Mon, 25 May 2015 07:30:08 +0000
(17:30 +1000)
buffer tainted (from fgets()) so tighten the loop conditions a bit.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/litest.c
patch
|
blob
|
history
diff --git
a/test/litest.c
b/test/litest.c
index 7a4938da8ab132e7bac8ef45dbafd39e859d9c61..040bfb4ae90774f38cf0d770be96d0b02fb53754 100644
(file)
--- 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++;