From e05f13837227104f8fa3441ff1085982fab20e2c Mon Sep 17 00:00:00 2001 From: Cyrus Harmon Date: Mon, 28 Mar 2011 02:42:09 +0000 Subject: [PATCH] 1.0.47.1: fix longstanding bug in os_get_runtime_executable_path on darwin * in os_get_runtime_executable_path, we were wrongly assuming that size would be set to the actual size of the string on a successful call to NSGetExecutablePath. This isn't the case and we were setting path[1025] = '\0'; causing things to break with XCode 4's CLANG compiler. * While we're at it, we should check to make that runtime_path is not NULL before we free it, as there is a code path where we might end up trying to free runtime_path when it was NULL but saved_runtime_path was non-NULL. --- src/runtime/darwin-os.c | 2 -- src/runtime/runtime.c | 3 ++- version.lisp-expr | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/runtime/darwin-os.c b/src/runtime/darwin-os.c index 2d79d06..5e6642f 100644 --- a/src/runtime/darwin-os.c +++ b/src/runtime/darwin-os.c @@ -36,8 +36,6 @@ os_get_runtime_executable_path(int external) if (_NSGetExecutablePath(path, &size) == -1) return NULL; - else - path[size] = '\0'; return copied_string(path); } diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c index 0f1f0ff..d03cd8d 100644 --- a/src/runtime/runtime.c +++ b/src/runtime/runtime.c @@ -337,7 +337,8 @@ main(int argc, char *argv[], char *envp[]) core = (runtime_path ? runtime_path : copied_string(saved_runtime_path)); } else { - free(runtime_path); + if (runtime_path) + free(runtime_path); } } diff --git a/version.lisp-expr b/version.lisp-expr index 5ba6139..023b4c8 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -20,4 +20,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.47" +"1.0.47.1" -- 1.7.10.4