From a3c4404cf6e1873a47d9e7c86b113bb6b91708b1 Mon Sep 17 00:00:00 2001 From: Noriko Hosoi Date: Mon, 23 Aug 2010 16:38:53 -0700 Subject: Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166 https://bugzilla.redhat.com/show_bug.cgi?id=611790 Resolves: bug 611790 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166 Fix description: Use the right pointer in LASIpAddPattern(). coverity ID: 11945 --- lib/libaccess/lasip.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/libaccess/lasip.cpp b/lib/libaccess/lasip.cpp index 0f3964d4..c59f5bbb 100644 --- a/lib/libaccess/lasip.cpp +++ b/lib/libaccess/lasip.cpp @@ -268,6 +268,10 @@ LASIpBuild(NSErr_t *errp, char *attr_name, CmpOp_t comparator, char *attr_patter char *plusptr; int retcode; + if (NULL == treetop) { + return ACL_RES_ERROR; + } + /* ip address can be delimited by space, tab, comma, or carriage return * only. */ @@ -343,8 +347,12 @@ LASIpAddPattern(NSErr_t *errp, int netmask, int pattern, LASIpTree_t **treetop) LASIpTree_t *curptr = NULL; /* pointer to the current node */ LASIpTree_t *newptr; + if (NULL == treetop) { + return ACL_RES_ERROR; + } + /* stop at the first 1 in the netmask from low to high */ - for (stopbit=0; stopbit<32; stopbit++) { + for (stopbit=0; stopbit<32; stopbit++) { if ((netmask&(1< 31) { - curptr->action[0] = (LASIpTree_t *)LAS_EVAL_TRUE; - curptr->action[1] = (LASIpTree_t *)LAS_EVAL_TRUE; + (*treetop)->action[0] = (LASIpTree_t *)LAS_EVAL_TRUE; + (*treetop)->action[1] = (LASIpTree_t *)LAS_EVAL_TRUE; return 0; } -- cgit