include/strutils: fix heap-buffer-overflow in normalize_whitespace()

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-06-14 16:29:21 +02:00
parent fce7b9501c
commit bef5ab005e
1 changed files with 1 additions and 1 deletions

View File

@ -334,7 +334,7 @@ static inline size_t normalize_whitespace(unsigned char *str)
else
str[x++] = str[i++];
}
if (nsp) /* tailing space */
if (nsp && x > 0) /* tailing space */
x--;
str[x] = '\0';
return x;