#192 Add NULL checks before string compares when analyzing a cert
Merged 2 years ago by rcritten. Opened 3 years ago by rcritten.
rcritten/certmonger issue_191  into  master

file modified
+2 -2
@@ -678,14 +678,14 @@ 

  		if (cert_storage != e->cm_cert_storage_type) {

  			continue;

  		}

- 		if (strcmp(cert_location, e->cm_cert_storage_location) != 0) {

+ 		if ((e->cm_cert_storage_location == NULL) || strcmp(cert_location, e->cm_cert_storage_location) != 0) {

  			continue;

  		}

  		switch (cert_storage) {

  		case cm_cert_storage_file:

  			break;

  		case cm_cert_storage_nssdb:

- 			if (strcmp(cert_nickname, e->cm_cert_nickname) != 0) {

+ 			if ((e->cm_cert_nickname == NULL) || strcmp(cert_nickname, e->cm_cert_nickname) != 0) {

  				continue;

  			}

  			break;

A user reported a segfault which was due to a broken request.
How it got broken I have no idea but it was effectively empty.

It had everything as defaults: 0, -1, UNSPECIFIED or not
present at all.

So when trying to analyze the request it did a NULL compare.

https://pagure.io/certmonger/issue/191

rebased onto 0eec70b

2 years ago

Pull-Request has been merged by rcritten

2 years ago
Metadata