summaryrefslogtreecommitdiffstats
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index eaf720f..f89c7ad 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -129,6 +129,8 @@ bool CanonicalizePath(char* path, size_t* len, unsigned int* slash_bits,
unsigned int bits = 0;
int bits_offset = 0;
for (char* c = path; (c = strpbrk(c, "/\\")) != NULL;) {
+ if (static_cast<size_t>(c - path) >= *len)
+ break;
bits |= (*c == '\\') << bits_offset;
*c++ = '/';
bits_offset++;