From a9b8f64233e92d268312db2c4423a6d3abc5b96d Mon Sep 17 00:00:00 2001 From: tongkai0808fh Date: Fri, 28 Jun 2024 07:16:37 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E8=A7=A3=E5=86=B3nterfaces/inner=5Fapi/sys?= =?UTF-8?q?cap=5Finterface.c=E6=96=87=E4=BB=B6=E4=B8=ADinputPos=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E9=9C=80=E5=88=A4=E7=A9=BA=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tongkai0808fh --- interfaces/inner_api/syscap_interface.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index c85b66a..bde4401 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -242,6 +242,11 @@ bool DecodePrivateSyscap(char *input, char (**output)[SINGLE_SYSCAP_LEN], int *o *output = outputArray; inputPos = input; + + if (inputPos == NULL) { + return false; + } + char buffer[SINGLE_FEAT_LEN] = {0}; char *bufferPos = buffer; while (*inputPos != '\0') { -- Gitee From 3886a16c9999a40d16e97f55712b7583e1c8fac1 Mon Sep 17 00:00:00 2001 From: tongkai0808fh Date: Fri, 28 Jun 2024 07:31:04 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0interfaces/inner=5Fapi/sy?= =?UTF-8?q?scap=5Finterface.c=E6=96=87=E4=BB=B6564=E8=A1=8C=E5=92=8C614?= =?UTF-8?q?=E8=A1=8C=EF=BC=8CtempSyscap=E5=92=8Ctemp=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=90=8E=E5=86=85=E5=AD=98=E9=87=8A=E6=94=BE?= =?UTF-8?q?=EF=BC=8C=E6=B6=88=E9=99=A4=E5=AE=89=E5=85=A8=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tongkai0808fh --- interfaces/inner_api/syscap_interface.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index bde4401..3e3384f 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -561,6 +561,7 @@ static int32_t CheckPcidEachBit(struct PcidPriSyscapInfo *pcidPriSyscapInfo, Com if (ret != EOK) { PRINT_ERR("strcpy_s failed.\n"); FreeCompareError(result); + free(tempSyscap); return -1; } result->syscap[pcidPriSyscapInfo->ossyscapFlag++] = tempSyscap; @@ -610,6 +611,7 @@ static int32_t ComparePcidWithPriSyscap(struct PcidPriSyscapInfo pcidPriSyscapIn if (temp == NULL) { PRINT_ERR("malloc failed.\n"); FreeCompareError(result); + free(temp); return -1; } pcidPriSyscapInfo.ret = strcpy_s(temp, sizeof(char) * SINGLE_SYSCAP_LEN, -- Gitee From 9ebb79ed11e02f7199691e0ad0c4fa3646e4d4c6 Mon Sep 17 00:00:00 2001 From: tongkai0808fh Date: Mon, 1 Jul 2024 09:03:21 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E5=8E=BB=E6=8E=89=20interfaces/inner=5Fapi?= =?UTF-8?q?/syscap=5Finterface.c=E6=96=87=E4=BB=B6614=E8=A1=8Cfree?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tongkai0808fh --- interfaces/inner_api/syscap_interface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 3e3384f..ca92b97 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -611,7 +611,6 @@ static int32_t ComparePcidWithPriSyscap(struct PcidPriSyscapInfo pcidPriSyscapIn if (temp == NULL) { PRINT_ERR("malloc failed.\n"); FreeCompareError(result); - free(temp); return -1; } pcidPriSyscapInfo.ret = strcpy_s(temp, sizeof(char) * SINGLE_SYSCAP_LEN, -- Gitee From 9b1c92d88d01c20c02284a3b9d8a0453d6c65717 Mon Sep 17 00:00:00 2001 From: tongkai0808fh Date: Mon, 1 Jul 2024 09:07:40 +0000 Subject: [PATCH 4/6] =?UTF-8?q?interfaces/inner=5Fapi/syscap=5Finterface.c?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0621=E8=A1=8C=EF=BC=8C?= =?UTF-8?q?=E9=87=8A=E6=94=BEtemp=E5=8F=98=E9=87=8F=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tongkai0808fh --- interfaces/inner_api/syscap_interface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index ca92b97..933f8ab 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -618,6 +618,7 @@ static int32_t ComparePcidWithPriSyscap(struct PcidPriSyscapInfo pcidPriSyscapIn if (pcidPriSyscapInfo.ret != EOK) { FreeCompareError(result); PRINT_ERR("strcpy_s failed.\n"); + free(temp); return -1; } result->syscap[pcidPriSyscapInfo.ossyscapFlag + prisyscapFlag] = temp; -- Gitee From 4882ca48657fd2b8e0ec25b1030a71670cc4787c Mon Sep 17 00:00:00 2001 From: tongkai0808fh Date: Mon, 1 Jul 2024 11:15:44 +0000 Subject: [PATCH 5/6] =?UTF-8?q?interfaces/inner=5Fapi/syscap=5Finterface.c?= =?UTF-8?q?=E5=8E=BB=E6=8E=89inputPos=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tongkai0808fh --- interfaces/inner_api/syscap_interface.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 933f8ab..97575d2 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -243,10 +243,6 @@ bool DecodePrivateSyscap(char *input, char (**output)[SINGLE_SYSCAP_LEN], int *o *output = outputArray; inputPos = input; - if (inputPos == NULL) { - return false; - } - char buffer[SINGLE_FEAT_LEN] = {0}; char *bufferPos = buffer; while (*inputPos != '\0') { -- Gitee From 4d43bdfbcdc99775ebefd76220be304ea46453b3 Mon Sep 17 00:00:00 2001 From: tongkai0808fh Date: Mon, 1 Jul 2024 11:26:00 +0000 Subject: [PATCH 6/6] =?UTF-8?q?interfaces/inner=5Fapi/syscap=5Finterface.c?= =?UTF-8?q?=E5=8E=BB=E6=8E=89245=E8=A1=8C=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: tongkai0808fh --- interfaces/inner_api/syscap_interface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 97575d2..10400be 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -242,7 +242,6 @@ bool DecodePrivateSyscap(char *input, char (**output)[SINGLE_SYSCAP_LEN], int *o *output = outputArray; inputPos = input; - char buffer[SINGLE_FEAT_LEN] = {0}; char *bufferPos = buffer; while (*inputPos != '\0') { -- Gitee