mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-28 08:30:07 +01:00
test: fix coverity complaint about unbounded loop
buffer tainted (from fgets()) so tighten the loop conditions a bit. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
d9f702918c
commit
c4be027b90
1 changed files with 2 additions and 2 deletions
|
|
@ -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++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue