From 3124564040b186c3ed40ddb4cc7f756ec092690a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 2 Dec 2018 16:27:08 +0100 Subject: [PATCH] deploy-ng: fix crash when using local logfile in non-writable dir Fixes #462 --- pandatool/src/deploy-stub/deploy-stub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandatool/src/deploy-stub/deploy-stub.c b/pandatool/src/deploy-stub/deploy-stub.c index 0acf31085a..5ce429335f 100644 --- a/pandatool/src/deploy-stub/deploy-stub.c +++ b/pandatool/src/deploy-stub/deploy-stub.c @@ -141,8 +141,8 @@ static int mkdir_parent(const wchar_t *path) { break; } } - if (buflen == 0) { - // There was no path separator. + if (buflen == (size_t)-1 || buflen == 0) { + // There was no path separator, or this was the root directory. return 0; } @@ -187,8 +187,8 @@ static int mkdir_parent(const char *path) { break; } } - if (buflen == 0) { - // There was no path separator. + if (buflen == (size_t)-1 || buflen == 0) { + // There was no path separator, or this was the root directory. return 0; } if (mkdir(buffer, 0755) == 0) {