We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 579a228 commit cfbe70dCopy full SHA for cfbe70d
stdlib/public/runtime/Paths.cpp
@@ -548,8 +548,9 @@ _swift_initRuntimePath(void *) {
548
// this is needed with Musl when statically linking because in that case
549
// dladdr() does nothing.
550
char pathBuf[4096];
551
- ssize_t len = readlink("/proc/self/exe", pathBuf, sizeof(pathBuf));
552
- if (len > 0 && len < sizeof(pathBuf)) {
+ ssize_t len = readlink("/proc/self/exe", pathBuf, sizeof(pathBuf)-1);
+ if (len > 0 ) {
553
+ pathBuf[len] = '\0';
554
runtimePath = ::strdup(pathBuf);
555
return;
556
}
0 commit comments