Page MenuHomeFreeBSD

D11474.id30393.diff
No OneTemporary

D11474.id30393.diff

Index: libexec/rtld-elf/rtld.c
===================================================================
--- libexec/rtld-elf/rtld.c
+++ libexec/rtld-elf/rtld.c
@@ -5279,7 +5279,8 @@
static int
open_binary_fd(const char *argv0, bool search_in_path)
{
- char *pathenv, *pe, binpath[PATH_MAX];
+ char *pathenv, binpath[PATH_MAX];
+ const char *pe;
int fd;
if (search_in_path && strchr(argv0, '/') == NULL) {
@@ -5296,16 +5297,19 @@
fd = -1;
errno = ENOENT;
while ((pe = strsep(&pathenv, ":")) != NULL) {
- if (strlcpy(binpath, pe, sizeof(binpath)) >
- sizeof(binpath))
- continue;
- if (binpath[0] != '\0' &&
- strlcat(binpath, "/", sizeof(binpath)) >
- sizeof(binpath))
- continue;
- if (strlcat(binpath, argv0, sizeof(binpath)) >
- sizeof(binpath))
- continue;
+ if (pe[0] == '\0') {
+ /*
+ * SHELL path: double, leading and trailing
+ * colons mean the current directory.
+ */
+ if (strlcpy(binpath, argv0, sizeof(binpath)) >=
+ sizeof(binpath))
+ continue;
+ } else {
+ if (snprintf(binpath, sizeof(binpath),
+ "%s/%s", pe, argv0) >= sizeof(binpath))
+ continue;
+ }
fd = open(binpath, O_RDONLY | O_CLOEXEC | O_VERIFY);
if (fd != -1 || errno != ENOENT)
break;

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 12, 11:34 PM (11 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31380171
Default Alt Text
D11474.id30393.diff (1 KB)

Event Timeline