Add NULL check logic on custum code 82/92082/2 accepted/tizen/3.0/common/20161114.112005 accepted/tizen/3.0/ivi/20161028.151242 accepted/tizen/3.0/mobile/20161028.143209 accepted/tizen/3.0/tv/20161028.143520 accepted/tizen/3.0/wearable/20161028.150839 accepted/tizen/common/20161013.160032 accepted/tizen/ivi/20161014.022342 accepted/tizen/mobile/20161014.022513 accepted/tizen/tv/20161014.022258 accepted/tizen/wearable/20161014.022400 submit/tizen/20161013.081319 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.092423 submit/tizen_3.0_common/20161104.104000
authorsangwan.kwon <sangwan.kwon@samsung.com>
Thu, 13 Oct 2016 07:42:08 +0000 (16:42 +0900)
committersangwan.kwon <sangwan.kwon@samsung.com>
Thu, 13 Oct 2016 07:57:45 +0000 (16:57 +0900)
Change-Id: I67a3e6e56af41e9cc0a8d27ded98895519f47650
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
src/xmldsig.c

index 0664c48..db33058 100644 (file)
@@ -913,6 +913,10 @@ xmlSecHexToInt(char a)
 
 static int
 xmlSecDecodeCmp(const xmlChar* encoded, const xmlChar* plain) {
+
+    xmlSecAssert2(encoded != NULL, -1);
+    xmlSecAssert2(plain != NULL, -1);
+
     while(*plain != NULL) {
         if(*encoded == NULL)
             return(-1);
@@ -966,6 +970,16 @@ xmlSecDSigCtxProcessReferences(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr firstReferen
             int isInProxy = 0;
             if(dsigCtx->proxyCtxPtr != NULL) {
                 xmlChar* refUri = xmlGetProp(cur, xmlSecAttrURI);
+                if(refUri == NULL) {
+                    xmlSecError(XMLSEC_ERRORS_HERE,
+                                NULL,
+                                NULL,
+                                XMLSEC_ERRORS_R_INVALID_NODE_ATTRIBUTE,
+                                "node=%s",
+                                xmlSecErrorsSafeString(xmlSecNodeGetName(cur)));
+                    return(-1);
+                }
+
                 xmlSecError(XMLSEC_ERRORS_HERE,
                             NULL,
                             NULL,
@@ -974,7 +988,6 @@ xmlSecDSigCtxProcessReferences(xmlSecDSigCtxPtr dsigCtx, xmlNodePtr firstReferen
                             refUri);
 
                 xmlSecProxyCtxPtr pc = dsigCtx->proxyCtxPtr;
-                int uriLen = strlen((const char*)refUri);
                 while(pc != NULL) {
                     if(xmlSecDecodeCmp(refUri, pc->cache) == 0) {
                         isInProxy = 1;