svace issue 101869 fixed. 97/75697/2
authorLim DoHyung <delight.lim@samsung.com>
Tue, 21 Jun 2016 05:07:07 +0000 (14:07 +0900)
committerLim DoHyung <delight.lim@samsung.com>
Tue, 21 Jun 2016 05:10:39 +0000 (22:10 -0700)
# commit format
[Issue]  svace have been checking that null value.
[Problem] binSerial array null value input as possible.
[Solution] In binSerial null check logic added.
[Verify] Launch the browser and I checked normal showing Serial number.

Change-Id: I7a95bdbdc145874c5d0e4c09dbc63794700ee8e0
Signed-off-by: Lim DoHyung <delight.lim@samsung.com>
services/CertificateService/CertificateContents.cpp

index 8abea629ad8437182cb0cfc8c4eb9492e55db53a..8c915a0e19377b7a7ac0c3c52c6e4631697d0d67 100644 (file)
@@ -402,10 +402,14 @@ static const char* _get_formatted_serial_no(ASN1_INTEGER *bs )
         char* l = (char*) (3*i + ((intptr_t) printable));
 
         if (i < (outsz -1)) {
-            snprintf(l, 4, "%02x%c", binSerial[i],':');
+            if(binSerial != nullptr) {
+                snprintf(l, 4, "%02x%c", binSerial[i],':');
+            }
         }
         else {
-            snprintf(l, 3, "%02x", binSerial[i]);
+            if(binSerial != nullptr) {
+                snprintf(l, 3, "%02x", binSerial[i]);
+            }
         }
     }
     free(binSerial);