CKM: Handle onlycap even if trailing space is missing 84/209184/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 3 Jul 2019 08:06:58 +0000 (10:06 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Fri, 12 Jul 2019 11:05:12 +0000 (11:05 +0000)
Change-Id: I45ee1a7f244662f80ec8eeaaf8141e1b4a52ad2c

src/common/scoped_process_label.cpp

index 793a6ef..aa642fe 100644 (file)
@@ -68,7 +68,10 @@ OnlycapSet smackGetOnlycap()
                        break;
 
                last = onlycap.find_first_of(SEPARATORS, first + 1);
-               onlycapSet.insert(onlycap.substr(first, last - first));
+               if (last == std::string::npos)
+                       onlycapSet.insert(onlycap.substr(first));
+               else
+                       onlycapSet.insert(onlycap.substr(first, last - first));
        }
        return onlycapSet;
 }