提交 a6b06ccf 编写于 作者: W WenJinyu 提交者: OB-robot

[CP] fix access_key decrypt bug

上级 474aaf01
......@@ -52,6 +52,21 @@ int hex_to_cstr(const void *in_data,
const int64_t buff_size)
{
int ret = OB_SUCCESS;
int64_t pos = 0;
if (OB_FAIL(hex_to_cstr(in_data, data_length, buff, buff_size, pos))) {
LOG_WARN("fail to hex to cstr", K(ret), K(in_data));
}
return ret;
}
int hex_to_cstr(const void *in_data,
const int64_t data_length,
char *buff,
const int64_t buff_size,
int64_t &pos)
{
int ret = OB_SUCCESS;
pos = 0;
if (OB_ISNULL(in_data) || 0 != data_length % 2
|| OB_ISNULL(buff) || buff_size < data_length / 2 + 1) {
ret = OB_INVALID_ARGUMENT;
......@@ -69,6 +84,7 @@ int hex_to_cstr(const void *in_data,
}
}
if (OB_SUCC(ret)) {
pos = data_length / 2;
buff[data_length / 2] = '\0';
}
return ret;
......
......@@ -43,6 +43,11 @@ int hex_to_cstr(const void *in_data,
const int64_t data_lenth,
char *buff,
const int64_t buff_size);
int hex_to_cstr(const void *in_data,
const int64_t data_length,
char *buff,
const int64_t buff_size,
int64_t &pos);
/**
* convert the input buffer into hex string, not include '\0'
*
......
......@@ -1310,7 +1310,7 @@ int ObBackupStorageInfo::parse_authorization_(const char *authorization)
}
} else if (0 == strncmp(ACCESS_KEY, token, strlen(ACCESS_KEY))) {
if (OB_FAIL(set_storage_info_field_(token, access_key_, sizeof(access_key_)))) {
LOG_WARN("failed to set access id", K(ret), K(token));
LOG_WARN("failed to set access key", K(ret), K(token));
}
} else {
ret = OB_INVALID_ARGUMENT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册