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);
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;
}