From: Michael D. Lowis Date: Mon, 19 Mar 2018 18:45:50 +0000 (-0400) Subject: Fixed a bad memory access in set_path_prop X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=9c133d19e827fb03adc31f1f5170eb815beb6dcd;p=projs%2Ftide.git Fixed a bad memory access in set_path_prop --- diff --git a/lib/win.c b/lib/win.c index 55fc9e9..198e4ae 100644 --- a/lib/win.c +++ b/lib/win.c @@ -1,3 +1,7 @@ +#define _POSIX_C_SOURCE 200809L +#define _XOPEN_SOURCE 700 +#include +#include #include #include #include @@ -67,9 +71,11 @@ static void win_update(int xfd, void* data) { } static void set_path_prop(char* path) { - char *abspath = realpath(path, NULL); + char pathbuf[PATH_MAX] = {0}; + if (!path) return; + char *abspath = realpath(path, pathbuf); + if (!abspath) return; x11_prop_set("TIDE_FILE", (!abspath ? "" : abspath)); - free(abspath); } void win_load(char* path) {