include/strutils: fix heap-buffer-overflow in normalize_whitespace()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
fce7b9501c
commit
bef5ab005e
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue