fix asan report heap overflow: str has no ending

This commit is contained in:
ly0
2021-11-03 20:38:08 +08:00
committed by LINxiansheng
parent 2e4c947fd7
commit e9ea5d7f57

View File

@ -168,7 +168,7 @@ OB_DEF_DESERIALIZE(ObCommonConfig)
ret = OB_ALLOCATE_MEMORY_FAILED; ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("ob tc malloc memory for buf fail", K(ret)); LOG_ERROR("ob tc malloc memory for buf fail", K(ret));
} else { } else {
MEMSET(copy_buf, '\0', config_str_length + 1); MEMSET(copy_buf, '\0', data_len + 1);
MEMCPY(copy_buf, buf + pos, data_len); MEMCPY(copy_buf, buf + pos, data_len);
if (OB_FAIL(add_extra_config(copy_buf))) { if (OB_FAIL(add_extra_config(copy_buf))) {
LOG_ERROR("Read server config failed", K(ret)); LOG_ERROR("Read server config failed", K(ret));