]> sourceware.org Git - lvm2.git/commitdiff
Fix segfault when invalid field given in reporting commands.
authorDave Wysochanski <dwysocha@redhat.com>
Mon, 15 Dec 2008 13:30:45 +0000 (13:30 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Mon, 15 Dec 2008 13:30:45 +0000 (13:30 +0000)
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

WHATS_NEW
lib/report/report.c

index 9b84b333db964f99454c46b8067bf14cea3a9877..86f8a2f296e608e7037597f580b0e4e711eb24ad 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
index 4c164c9b471278fbc83c7fd241d6865a0a028d4d..a439c80f3dae59ef57f27c17923e9e380103c287 100644 (file)
@@ -1108,7 +1108,7 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
        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;
This page took 0.043598 seconds and 5 git commands to generate.