swap: Add +1 to strlen() for strncmp 41/315741/1 accepted/tizen/unified/20241205.173755 accepted/tizen/unified/x/20241218.032531 accepted/tizen/unified/x/asan/20241224.004258
authorUnsung Lee <unsung.lee@samsung.com>
Wed, 4 Dec 2024 08:01:46 +0000 (17:01 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Wed, 4 Dec 2024 08:01:49 +0000 (17:01 +0900)
Add plus 1 to return value of strlen() to compare two strings
using strncmp().

Change-Id: I198f680f475f3028f03afc3d4933508556705b61
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/resource-optimizer/memory/swap/swap.c

index 3c5ee30d487f4b4c91de71a7cbec524df0ba304c..ab14075f55781635050757cce44516e799b78ec4 100644 (file)
@@ -267,7 +267,7 @@ static int swap_use_force_reclaim(char *memcg)
         * But instead, try to swap memory as much as possible.
         * It will be happend only once after booting done.
         */
-       len = strlen(memcg);
+       len = strlen(memcg) + 1;
        if (!strncmp(memcg, MEMCG_PATH, len))
                root_memcg = true;