Found by coverity. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- libmpathutil/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmpathutil/util.c b/libmpathutil/util.c index 67db3c8..9c422f1 100644 --- a/libmpathutil/util.c +++ b/libmpathutil/util.c @@ -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; } -- 2.45.2