From 69d870e276b4511aba56d4a13b998a4040b1d1eb Mon Sep 17 00:00:00 2001 From: Stefan Wildemann Date: Wed, 21 Sep 2022 21:38:10 +0200 Subject: fix:core:Forcefully terminate string read with fgets --- navit/navit.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'navit') diff --git a/navit/navit.c b/navit/navit.c index f01c9efcd..e6e43064d 100644 --- a/navit/navit.c +++ b/navit/navit.c @@ -1806,6 +1806,8 @@ static int navit_former_destinations_active(struct navit *this_) { if (destination_file) { while(fgets(lastline, sizeof(lastline), destination_file)); fclose(destination_file); + /*forcefully terminate the string, there is no proper fgets error handling.*/ + lastline[sizeof(lastline) -1] = 0; if (strcmp(lastline, TEXTFILE_COMMENT_NAVI_STOPPED)) { active=1; } -- cgit v1.2.1