Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/report/report.c

PATCH [email protected] 1 participant 1 message Dec 15, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2008-12-15 13:30:46

Modified files:
. : WHATS_NEW
lib/report : report.c

Log message:
Fix segfault when invalid field given in reporting commands.

Problem is dm_report_init() may return NULL and subsequent call to dm_report_set_output_field_name_prefix() doesn't handle NULL value.

Example:
pvs --nameprefixes --rows --unquoted --noheadings -opv_name,fred Logical Volume Fields
---------------------
lv_uuid - Unique identifier
lv_name - Name. LVs created for internal use are enclosed in brackets.
...

Physical Volume Segment Fields
------------------------------
pvseg_start - Physical Extent number of start of segment.
pvseg_size - Number of extents in segment.

Unrecognised field: fred
Segmentation fault

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1008&r2=1.1009
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.90&r2=1.91

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.44 - 
 ====================================
+  Fix segfault when invalid field given in reporting commands.
   Refactor init_lvm() for lvmcmdline and clvmd.
   Add liblvm interactive test infrastructure to build.
   Use better random seed value in temp file creation.
lib/report/report.c +1 -1
@@ -1108,7 +1108,7 @@
 	rh = dm_report_init(report_type, _report_types, _fields, format,
 			    separator, report_flags, keys, cmd);
 
-	if (field_prefixes)
+	if (rh && field_prefixes)
 		dm_report_set_output_field_name_prefix(rh, "lvm2_");
 
 	return rh;