Skip to contentSkip to conversation

master - libdm: put in secure check

PATCH Zdenek Kabelac 1 participant 1 message Nov 13, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d74e1291cd43f50010c22fb2c071d92390a26d28
Commit:        d74e1291cd43f50010c22fb2c071d92390a26d28
Parent:        0128770d6d881c7f30fc5e22137d1b20ce003e13
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Nov 11 22:51:23 2015 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Nov 13 11:17:05 2015 +0100

libdm: put in secure check

Coverity complains about NULL deref - while this cannot currently happen, put in secure INTERNAL_ERROR.

---
 libdm/libdm-report.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
libdm/libdm-report.c +4 -0
index b9906d8..38dde07 100644
@@ -3527,6 +3527,10 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
 				}
 				break;
 			case DM_REPORT_FIELD_TYPE_STRING_LIST:
+				if (!custom) {
+					log_error(INTERNAL_ERROR "Custom selection list is undefined.");
+					goto error;
+				}
 				fs->value->v.l = *(struct selection_str_list **)custom;
 				if (_check_value_is_strictly_reserved(rh, field_num, DM_REPORT_FIELD_TYPE_STRING_LIST, fs->value->v.l, NULL)) {
 					log_error("String list value found in selection is reserved.");