trim_trailing_whitespace: avoid invalid memory access/read

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
This commit is contained in:
Nikos Mavrogiannopoulos
2018-04-14 10:00:45 +02:00
parent 82bc4fb841
commit f1e3d1e0a7

View File

@@ -37,7 +37,7 @@ void trim_trailing_whitespace(char *str)
if (len > 0) {
p = str+len-1;
while (c_isspace(*p) && p >= str) {
while (p >= str && c_isspace(*p)) {
*p = 0;
p--;
}