summaryrefslogtreecommitdiff
path: root/linker/linker_utils.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2018-10-04 14:45:55 -0700
committerRyan Prichard <rprichard@google.com>2018-10-08 13:27:16 -0700
commit269bb496c56dcf268831e02df035040162f30590 (patch)
tree822f2f0cd22cfc397273ccca827414679e842b77 /linker/linker_utils.cpp
parent0adf09b3705c54733e46ace3b6cf08b78533729e (diff)
Fix normalize_path's handling of "/.."
Currently it normalizes the path to a string with a single uninitialized byte. It should instead normalize it to "/". Bug: none Test: /data/nativetest/linker-unit-tests/linker-unit-tests32 Test: /data/nativetest64/linker-unit-tests/linker-unit-tests64 Change-Id: I06e0f7598d16acfa21875dad53efbc293cfeb44d
Diffstat (limited to 'linker/linker_utils.cpp')
-rw-r--r--linker/linker_utils.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index 789d5c1b8..6b9aec9fa 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -98,8 +98,8 @@ bool normalize_path(const char* path, std::string* normalized_path) {
while (out_ptr > buf && *--out_ptr != '/') {
}
if (in_ptr[0] == 0) {
- // retain '/'
- out_ptr++;
+ // retain '/' (or write the initial '/' for "/..")
+ *out_ptr++ = '/';
}
continue;
}