Skip to content

Commit

Permalink
libmpathutil: avoid size_t underflow in strchop()
Browse files Browse the repository at this point in the history
Found by coverity.

Signed-off-by: Martin Wilck <[email protected]>
  • Loading branch information
mwilck committed Jul 18, 2024
1 parent 1024dc2 commit c92467e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libmpathutil/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ strchop(char *str)
{
size_t i;

for (i = strlen(str) - 1; i != (size_t) -1 && isspace(str[i]); i--) ;
str[++i] = '\0';
for (i = strlen(str); i != 0 && isspace(str[i - 1]); i--) ;
str[i] = '\0';
return i;
}

Expand Down

0 comments on commit c92467e

Please sign in to comment.