1 Star 0 Fork 32

fantaotao1/gazelle

forked from src-openEuler/gazelle 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0236-dfx-security-function-failed-return-error-directly.patch 2.08 KB
一键复制 编辑 原始数据 按行查看 历史
kircher 提交于 2023-05-16 15:57 . sync add-udp-multicast-support-in-gazelle
From b3b492c64bab47d4bb898422fb9a57a2536e0d61 Mon Sep 17 00:00:00 2001
From: jiangheng12 <jiangheng14@huawei.com>
Date: Wed, 26 Apr 2023 20:06:42 +0800
Subject: [PATCH] dfx: security function failed, return error directly
---
src/ltran/ltran_dfx.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/ltran/ltran_dfx.c b/src/ltran/ltran_dfx.c
index 4baca26..944675e 100644
--- a/src/ltran/ltran_dfx.c
+++ b/src/ltran/ltran_dfx.c
@@ -206,12 +206,14 @@ static int32_t dfx_connect_ltran(bool use_ltran, bool probe)
ret = memset_s(&addr, sizeof(addr), 0, sizeof(struct sockaddr_un));
if (ret != EOK) {
printf("%s:%d memset_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
+ goto END;
}
ret = strncpy_s(addr.sun_path, sizeof(addr.sun_path), GAZELLE_RUN_DIR,
strlen(GAZELLE_RUN_DIR) + 1);
if (ret != EOK) {
printf("%s:%d strncpy_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
+ goto END;
}
if (g_unix_prefix) {
@@ -219,6 +221,7 @@ static int32_t dfx_connect_ltran(bool use_ltran, bool probe)
strlen(g_unix_prefix) + 1);
if (ret != EOK) {
printf("%s:%d strncat_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
+ goto END;
}
}
@@ -234,6 +237,7 @@ static int32_t dfx_connect_ltran(bool use_ltran, bool probe)
strlen(GAZELLE_REG_SOCK_FILENAME) + 1);
if (ret != EOK) {
printf("%s:%d strncat_s fail ret=%d\n", __FUNCTION__, __LINE__, ret);
+ goto END;
}
}
@@ -243,11 +247,13 @@ static int32_t dfx_connect_ltran(bool use_ltran, bool probe)
printf("connect ltran failed. errno: %d ret=%d\n", errno, ret);
printf("You may need to use the -u parameter to specify the UNIX_PREFIX that matches the configuration.\n");
}
- close(fd);
- return GAZELLE_ERR;
+ goto END;
}
return fd;
+END:
+ close(fd);
+ return GAZELLE_ERR;
}
static int32_t dfx_stat_conn_to_ltran(struct gazelle_stat_msg_request *req_msg)
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fantaotao1/gazelle.git
git@gitee.com:fantaotao1/gazelle.git
fantaotao1
gazelle
gazelle
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385