[MTE] use static buffer for per-process property name.

Change-Id: I3b0d0fdffe72aef7d66544fecac18f7a097ddbaf
This commit is contained in:
Florian Mayer 2022-08-01 15:02:25 -07:00
parent 4ebdeebef7
commit 27914298f5

View file

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