Skip to content

Commit

Permalink
bug: fix crash on Apple platforms (lvgl#13)
Browse files Browse the repository at this point in the history
For some obscure reason, `_NSGetExecutablePath(char* buf, uint32_t* bufsize)`
writes `bufsize + 1` characters into `buf`, hence we are allocating the buffer as
`PATH_MAX + 1`.
  • Loading branch information
derekstavis authored Aug 6, 2023
1 parent ec833d1 commit 3a708b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/utils.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "utils.h"

void GetProgramDir (char* buf) {
char str[PATH_MAX];
char str[PATH_MAX + 1];
char* dir;

#ifdef __APPLE__
Expand Down Expand Up @@ -111,4 +111,4 @@ void ReplenishExt (char* path) {
if (ext[0] == '\0') {
strcat(path, ".js");
}
}
}

0 comments on commit 3a708b6

Please sign in to comment.