Fix SEGFAULT in profman
Fix the size of profman argument array.
Test: installd_dexopt_test
Bug: 110035108
(cherry picked from commit ade5507f4998aeab574334b4ad1a887061612b6c)
Merged-In: Ifca6744660b1538668aed7864eddf0d5aad0736d
Change-Id: I87a54893e63d5f1ad06784c11d9933a4f35aa5e5
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index a19ce09..9dfbfd3 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -771,7 +771,8 @@
}
// program name, reference profile fd, the final NULL and the profile fds
- const char* argv[3 + profile_args.size() + apk_args.size() + (copy_and_update ? 1 : 0)];
+ const char* argv[3 + profile_args.size() + apk_args.size()
+ + dex_location_args.size() + (copy_and_update ? 1 : 0)];
int i = 0;
argv[i++] = profman_bin;
argv[i++] = reference_profile_arg.c_str();