From: Michael D. Lowis Date: Mon, 24 Oct 2016 22:57:50 +0000 (-0400) Subject: Fixed a buffer overflow for long paths in the status bar X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=8dcb9f317a74c30bf33c881b27307bba981025a0;p=projs%2Ftide.git Fixed a buffer overflow for long paths in the status bar --- diff --git a/xedit.c b/xedit.c index 0dda2ed..0e4f282 100644 --- a/xedit.c +++ b/xedit.c @@ -361,6 +361,13 @@ static void draw_status(XftColor* fg, unsigned ncols) { (status++)->rune = (Buffer.modified ? '*' : ' '); (status++)->rune = ' '; char* path = Buffer.path; + size_t len = strlen(path); + if (len > ncols-4) { + (status++)->rune = '.'; + (status++)->rune = '.'; + (status++)->rune = '.'; + path += (len - ncols) + 6; + } while(*path) (status++)->rune = *path++; draw_runes(0, 0, fg, NULL, glyphs, status - glyphs);