mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Fix buffer overflow in TryPath (#1035)
Missed this when changing the code back to be like the old version. com is now a parameter. The only plausible way to trigger this would be to pass a loader pathname close to MAX_PATH characters long, and then remove that path prior to the first sys_faccessat.
This commit is contained in:
parent
85e4c020a3
commit
7faffde303
1 changed files with 1 additions and 0 deletions
|
@ -98,6 +98,7 @@ static int TryPath(const char *q, int com) {
|
|||
}
|
||||
*p = 0;
|
||||
if (!sys_faccessat(AT_FDCWD, g_prog.u.buf, F_OK, 0)) return 1;
|
||||
if (!com) return 0;
|
||||
p = WRITE32LE(p, READ32LE(".com"));
|
||||
*p = 0;
|
||||
if (!sys_faccessat(AT_FDCWD, g_prog.u.buf, F_OK, 0)) return 1;
|
||||
|
|
Loading…
Reference in a new issue