| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
`path.win32.normalize()` checked for Windows reserved device names
(CON, NUL, PRN, LPT1, etc.) without first ensuring the path actually
contained a colon. When no colon was present, `indexOf(':')` returned
-1 and `isWindowsReservedName()` sliced off the last character instead
of slicing up to a colon, so any filename equal to a reserved name plus
one trailing character was wrongly treated as a device and prefixed with
`.\` — e.g. `normalize('CONx')` returned `.\CONx` instead of `CONx`.
Guard the check with `colonIndex !== -1`, matching the other reserved
name call sites which are already guarded by `colonIndex > 0`.
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
|
Review requested:
|
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm
Sorry, something went wrong.
`path.win32.normalize()` checked for Windows reserved device names
(CON, NUL, PRN, LPT1, etc.) without first ensuring the path actually
contained a colon. When no colon was present, `indexOf(':')` returned
-1 and `isWindowsReservedName()` sliced off the last character instead
of slicing up to a colon, so any filename equal to a reserved name plus
one trailing character was wrongly treated as a device and prefixed with
`.\` — e.g. `normalize('CONx')` returned `.\CONx` instead of `CONx`.
Guard the check with `colonIndex !== -1`, matching the other reserved
name call sites which are already guarded by `colonIndex > 0`.
Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
PR-URL: #64159
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
This reverts commit b0a4f16 as it was merged without green Jenkins CI and subsequent builds are broken. Refs: nodejs#64159 Signed-off-by: Anna Henningsen <anna@addaleax.net>
This reverts commit b0a4f16 as it was merged without green Jenkins CI and subsequent builds are broken. Refs: #64159 Signed-off-by: Anna Henningsen <anna@addaleax.net> PR-URL: #64216 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
| Back | FazBrowse Home | New Git URL |
path.win32.normalize() checked for Windows reserved device names (CON, NUL, PRN, LPT1, etc.) without first ensuring the path actually contained a colon. When no colon was present, indexOf(':') returned -1 and isWindowsReservedName() sliced off the last character instead of slicing up to a colon, so any filename equal to a reserved name plus one trailing character was wrongly treated as a device and prefixed with .\ — e.g. normalize('CONx') returned .\CONx instead of CONx.
Guard the check with colonIndex !== -1, matching the other reserved name call sites which are already guarded by colonIndex > 0.