mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
src: do not read string out of bounds
PR-URL: https://github.com/nodejs/node/pull/51358 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Keyhan Vakil <kvakil@sylph.kvakil.me> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
This commit is contained in:
1 parent
4d06d80675
commit
36e42aa570
1 file changed
+5
-6
+5
-6
@@ -24,15 +24,14 @@ std::string NormalizeString(const std::string_view path,
|
||||
int lastSegmentLength = 0;
|
||||
int lastSlash = -1;
|
||||
int dots = 0;
|
||||
char code;
|
||||
const auto pathLen = path.size();
|
||||
for (uint8_t i = 0; i <= pathLen; ++i) {
|
||||
if (i < pathLen) {
|
||||
char code = 0;
|
||||
for (size_t i = 0; i <= path.size(); ++i) {
|
||||
if (i < path.size()) {
|
||||
code = path[i];
|
||||
} else if (IsPathSeparator(path[i])) {
|
||||
} else if (IsPathSeparator(code)) {
|
||||
break;
|
||||
} else {
|
||||
code = node::kPathSeparator;
|
||||
code = '/';
|
||||
}
|
||||
|
||||
if (IsPathSeparator(code)) {
|
||||
|
||||
Reference in new issue
Block a user