Bug 1309133 - Ensure termination of the correct buffer. r?jld draft
authorGian-Carlo Pascutto <gcp@mozilla.com>
Tue, 11 Oct 2016 14:43:09 +0200
changeset 423624 6f73a52466541b8d2213ca318c2056732b9d68e2
parent 423623 8030f70a51308de1e8448e538817b86b7315721e
child 423663 ade03098f4cbbf60cb8845884a7c51ac16cbb3e7
push id31947
push usergpascutto@mozilla.com
push dateTue, 11 Oct 2016 12:43:37 +0000
reviewersjld
bugs1309133
milestone52.0a1
Bug 1309133 - Ensure termination of the correct buffer. r?jld MozReview-Commit-ID: LjQkwgNsiwh
security/sandbox/linux/broker/SandboxBroker.cpp
--- a/security/sandbox/linux/broker/SandboxBroker.cpp
+++ b/security/sandbox/linux/broker/SandboxBroker.cpp
@@ -518,17 +518,17 @@ SandboxBroker::ThreadMain(void)
       // Look up the first pathname but first translate relative paths.
       pathLen = ConvertToRealPath(pathBuf, sizeof(pathBuf), pathLen);
       perms = mPolicy->Lookup(nsDependentCString(pathBuf, pathLen));
 
       // Same for the second path.
       pathLen2 = strnlen(pathBuf2, kMaxPathLen);
       if (pathLen2 > 0) {
         // Force 0 termination.
-        pathBuf[pathLen2] = '\0';
+        pathBuf2[pathLen2] = '\0';
         pathLen2 = ConvertToRealPath(pathBuf2, sizeof(pathBuf2), pathLen2);
         int perms2 = mPolicy->Lookup(nsDependentCString(pathBuf2, pathLen2));
 
         // Take the intersection of the permissions for both paths.
         perms &= perms2;
       }
     } else {
       // Failed to receive intelligible paths.