[haiku-commits] haiku: hrev52179 - src/system/kernel/vm

  • From: Kacper Kasper <kacperkasper@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 6 Aug 2018 17:08:15 -0400 (EDT)

hrev52179 adds 1 changeset to branch 'master'
old head: 3f45e1e6ef520ad189ba680fef0460bc19fe48fa
new head: 7cea6679a8a1c7090d87fa9a48384efd5fe2849e
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=7cea6679a8a1+%5E3f45e1e6ef52

----------------------------------------------------------------------------

7cea6679a8a1: kernel: vm: fix off-by-one errors in get_mount_point
  
  * Fix for 03df8bfcf2b58bf114cf876eccdd5242448926ce.
  * Fix misleading indentation.
  * Fixes #14225.

                                  [ Kacper Kasper <kacperkasper@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev52179
Commit:      7cea6679a8a1c7090d87fa9a48384efd5fe2849e
URL:         https://git.haiku-os.org/haiku/commit/?id=7cea6679a8a1
Author:      Kacper Kasper <kacperkasper@xxxxxxxxx>
Date:        Mon Aug  6 21:01:38 2018 UTC

Ticket:      https://dev.haiku-os.org/ticket/14225

----------------------------------------------------------------------------

1 file changed, 4 insertions(+), 3 deletions(-)
src/system/kernel/vm/VMAnonymousCache.cpp | 7 ++++---

----------------------------------------------------------------------------

diff --git a/src/system/kernel/vm/VMAnonymousCache.cpp 
b/src/system/kernel/vm/VMAnonymousCache.cpp
index 51c5aded1d..ebffd9a4d5 100644
--- a/src/system/kernel/vm/VMAnonymousCache.cpp
+++ b/src/system/kernel/vm/VMAnonymousCache.cpp
@@ -1263,16 +1263,17 @@ get_mount_point(KPartition* partition, KPath* 
mountPoint)
                }
        }
 
-       BStackOrHeapArray<char, 128> basePath(nameLength + 1);
+       BStackOrHeapArray<char, 128> basePath(nameLength + 2);
        if (!basePath.IsValid())
                return B_NO_MEMORY;
-       int32 len = snprintf(basePath, nameLength + 1, "/%s", volumeName);
+       int32 len = snprintf(basePath, nameLength + 2, "/%s", volumeName);
        for (int32 i = 1; i < len; i++)
                if (basePath[i] == '/')
-               basePath[i] = '-';
+                       basePath[i] = '-';
        char* path = mountPoint->LockBuffer();
        int32 pathLen = mountPoint->BufferSize();
        strncpy(path, basePath, pathLen);
+       panic("OH NO");
 
        struct stat dummy;
        for (int i = 1; ; i++) {


Other related posts:

  • » [haiku-commits] haiku: hrev52179 - src/system/kernel/vm - Kacper Kasper