From 7a42f7dd41f60951491f3ebbf2417e53cd1755c6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 16 Jul 2013 12:51:54 -0400 Subject: [PATCH] Fixed off-by-one error in findBinaryInPath() (thanks, Dmitry!). This bug is new to the development branch, and doesn't exist in either the stable-1.0 or stable-2.0 branches. --- docs/CREDITS.txt | 3 +++ src/platform_unix.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/CREDITS.txt b/docs/CREDITS.txt index 796f74f2..b961e72a 100644 --- a/docs/CREDITS.txt +++ b/docs/CREDITS.txt @@ -133,6 +133,9 @@ Haiku fixes: SLB archiver: Aleksi Nurmi +Bug fixes: + Dmitry Marakasov + Other stuff: Your name here! Patches go to icculus@icculus.org ... diff --git a/src/platform_unix.c b/src/platform_unix.c index 51af43a1..cb58bdbd 100644 --- a/src/platform_unix.c +++ b/src/platform_unix.c @@ -193,7 +193,7 @@ static char *findBinaryInPath(const char *bin, char *envr) if (access(exe, X_OK) == 0) /* Exists as executable? We're done. */ { - exe[size - binlen] = '\0'; /* chop off filename, leave '/' */ + exe[(size - binlen) - 1] = '\0'; /* chop off filename, leave '/' */ return exe; } /* if */