Merge "[MTE] use static buffer for per-process property name." am: c7bf4d419c

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2169035

Change-Id: I6a8ecb79989654d1f75006d822409e4db130de9e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2022-08-02 00:08:43 +00:00 committed by Automerger Merge Worker
commit f955373494

View file

@ -224,17 +224,14 @@ static bool get_environment_memtag_setting(HeapTaggingLevel* level) {
const char* basename = __gnu_basename(progname); const char* basename = __gnu_basename(progname);
static constexpr size_t kOptionsSize = PROP_VALUE_MAX; char options_str[PROP_VALUE_MAX];
char options_str[kOptionsSize]; char sysprop_name[512];
size_t sysprop_size = strlen(basename) + strlen(kMemtagPrognameSyspropPrefix) + 1; async_safe_format_buffer(sysprop_name, sizeof(sysprop_name), "%s%s", kMemtagPrognameSyspropPrefix,
char* sysprop_name = static_cast<char*>(alloca(sysprop_size));
async_safe_format_buffer(sysprop_name, sysprop_size, "%s%s", kMemtagPrognameSyspropPrefix,
basename); basename);
const char* sys_prop_names[] = {sysprop_name, kMemtagGlobalSysprop}; const char* sys_prop_names[] = {sysprop_name, kMemtagGlobalSysprop};
if (!get_config_from_env_or_sysprops("MEMTAG_OPTIONS", sys_prop_names, arraysize(sys_prop_names), if (!get_config_from_env_or_sysprops("MEMTAG_OPTIONS", sys_prop_names, arraysize(sys_prop_names),
options_str, kOptionsSize)) { options_str, sizeof(options_str))) {
return false; return false;
} }