Browse code

core: main - set ending 0 in allocated cfg file path

(cherry picked from commit 15f57ceae26b967ad92dd3a97ebcd869d1197244)

Daniel-Constantin Mierla authored on 15/04/2021 08:28:24
Showing 1 changed files
... ...
@@ -1281,7 +1281,7 @@ int fix_cfg_file(void)
1281 1281
 		}
1282 1282
 		if ((res = malloc(cfg_len + 1)) == NULL) goto error;
1283 1283
 		memcpy(res, cfg_file, cfg_len);
1284
-		cfg_file[cfg_len] = 0;
1284
+		res[cfg_len] = 0;
1285 1285
 		cfg_file = res;
1286 1286
 		return 0;
1287 1287
 	}