Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151991161
D11474.id30393.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D11474.id30393.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11474: Slight cleanup in open_binary_fd.
Attached
Detach File
Event Timeline
Log In to Comment