mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 01:57:43 +00:00
In some cases (if profiles in complain and enforce mode are loaded), the `i` loop runs more than once, which also means `j == 0` is true in the middle of the json. This causes invalid json. This patch fixes this. This is a regression related to 22aa9b61615b72c20d96f8eeeac0a3f6ff0a5d1e / https://gitlab.com/apparmor/apparmor/-/merge_requests/964 / https://gitlab.com/apparmor/apparmor/-/issues/295 which fixed another case of invalid json if a process was unconfined while having a profile defined. Note: I also tested this patch for the "unconfined, but has a profile defined" case to ensure it doesn't break what 22aa9b61615b72c20d96f8eeeac0a3f6ff0a5d1e fixed.