summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Herlant <aerostitch@debian.org>2019-10-22 00:37:48 -0700
committerJoseph Herlant <aerostitch@debian.org>2019-10-22 00:37:48 -0700
commit1cecebf85ca4ae8ca152a3e8169a7ebc5ff8a368 (patch)
tree23ddbdb5884a8ec8428d5b19a5fe33368ac45e3a
parent39707705c154276e098accb551aa03d22c5fb7ee (diff)
downloadnavit-1cecebf85ca4ae8ca152a3e8169a7ebc5ff8a368.tar.gz
Handle case when the string will only contain chars that will be discarded
-rw-r--r--navit/search.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/navit/search.c b/navit/search.c
index 62eb37dce..e700f4355 100644
--- a/navit/search.c
+++ b/navit/search.c
@@ -167,6 +167,9 @@ char *search_fix_spaces(const char *str) {
len--;
}
} while (c);
+ // Make sure the string is terminated at current position even if nothing has been added to it.
+ // This case happen when you use a string containing only chars that will be discarded.
+ *d='\0';
return ret;
}