提交 501acbb9 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!696 iSulad: initialization buf before readlink()

Merge pull request !696 from zhangxiaoyu/master
......@@ -56,7 +56,7 @@ using ::testing::Invoke;
std::string get_dir()
{
char abs_path[PATH_MAX];
char abs_path[PATH_MAX] { 0x00 };
int ret = readlink("/proc/self/exe", abs_path, sizeof(abs_path));
if (ret < 0 || (size_t)ret >= sizeof(abs_path)) {
return "";
......
......@@ -47,7 +47,7 @@ using ::testing::_;
std::string GetDirectory()
{
char abs_path[PATH_MAX];
char abs_path[PATH_MAX] { 0x00 };
int ret = readlink("/proc/self/exe", abs_path, sizeof(abs_path));
if (ret < 0 || (size_t)ret >= sizeof(abs_path)) {
return "";
......
......@@ -42,7 +42,7 @@ using ::testing::FLAGS_gmock_catch_leaked_mocks;
std::string GetDirectory()
{
char abs_path[PATH_MAX];
char abs_path[PATH_MAX] { 0x00 };
int ret = readlink("/proc/self/exe", abs_path, sizeof(abs_path));
if (ret < 0 || (size_t)ret >= sizeof(abs_path)) {
return "";
......
......@@ -43,7 +43,7 @@ using ::testing::_;
std::string GetDirectory()
{
char abs_path[PATH_MAX];
char abs_path[PATH_MAX] { 0x00 };
int ret = readlink("/proc/self/exe", abs_path, sizeof(abs_path));
if (ret < 0 || (size_t)ret >= sizeof(abs_path)) {
return "";
......
......@@ -35,7 +35,7 @@ std::string META_DATA_CONTENT = "metadata test";
std::string GetDirectory()
{
char abs_path[PATH_MAX];
char abs_path[PATH_MAX] { 0x00 };
int ret = readlink("/proc/self/exe", abs_path, sizeof(abs_path));
if (ret < 0 || (size_t)ret >= sizeof(abs_path)) {
return "";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册