From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mx.groups.io with SMTP id smtpd.web09.15898.1605238328692245710 for ; Thu, 12 Nov 2020 19:32:09 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.191, mailfrom: xiewenyi2@huawei.com) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CXPCS1GKHzLwJS; Fri, 13 Nov 2020 11:31:48 +0800 (CST) Received: from HGH1000039998.huawei.com (10.184.68.188) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Fri, 13 Nov 2020 11:31:54 +0800 From: "wenyi,xie" To: CC: , , Bob Feng , Liming Gao , Yuwei Chen Subject: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check Date: Fri, 13 Nov 2020 11:30:30 +0800 Message-ID: <1605238230-35859-2-git-send-email-xiewenyi2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1605238230-35859-1-git-send-email-xiewenyi2@huawei.com> References: <1605238230-35859-1-git-send-email-xiewenyi2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.184.68.188] X-CFilter-Loop: Reflected Content-Type: text/plain add NULL point check after allocating. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Wenyi Xie --- BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c index 051ee4ec5d28..122878fc49e9 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c +++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c @@ -1704,6 +1704,7 @@ char *s; require(ua!=NULL, "cannot allocate UserAction"); ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(ua->action!=NULL, "cannot allocate action"); strcpy(ua->action, s); return ua; } @@ -1742,6 +1743,7 @@ int altnum; char *p; sprintf(buf, "_blk%d_alt%d", blockid, altnum); p = (char *)malloc(strlen(buf)+1); + require(p!=NULL, "cannot allocate buf"); strcpy(p, buf); return p; } -- 2.20.1.windows.1