Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 36e42aa

Browse filesBrowse files
zcbenztargos
authored andcommitted
src: do not read string out of bounds
PR-URL: #51358 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Keyhan Vakil <kvakil@sylph.kvakil.me> Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
1 parent 4d06d80 commit 36e42aa
Copy full SHA for 36e42aa

File tree

Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-6
lines changed
Open diff view settings
Collapse file

‎src/path.cc‎

Copy file name to clipboardExpand all lines: src/path.cc
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ std::string NormalizeString(const std::string_view path,
2424
int lastSegmentLength = 0;
2525
int lastSlash = -1;
2626
int dots = 0;
27-
char code;
28-
const auto pathLen = path.size();
29-
for (uint8_t i = 0; i <= pathLen; ++i) {
30-
if (i < pathLen) {
27+
char code = 0;
28+
for (size_t i = 0; i <= path.size(); ++i) {
29+
if (i < path.size()) {
3130
code = path[i];
32-
} else if (IsPathSeparator(path[i])) {
31+
} else if (IsPathSeparator(code)) {
3332
break;
3433
} else {
35-
code = node::kPathSeparator;
34+
code = '/';
3635
}
3736

3837
if (IsPathSeparator(code)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.