1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: fix reporting of empty string list

Don't write behind the allocated array when list is empty.
Use index 0 for the allocated element.

Error triggered by i.e.:  lvs -a -o all,lv_modules
This commit is contained in:
Zdenek Kabelac 2014-11-22 18:13:21 +01:00
parent 75d79f3dad
commit fc935495c8
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.92 - Version 1.02.92 -
==================================== ====================================
Fix memory corruption with sorting empty string lists (1.02.86).
Fix man dmsetup.8 syntax warning of Groff Fix man dmsetup.8 syntax warning of Groff
Version 1.02.91 - 11th November 2014 Version 1.02.91 - 11th November 2014

View File

@ -378,8 +378,8 @@ static int _report_field_string_list(struct dm_report *rh,
/* zero items */ /* zero items */
if (!list_size) { if (!list_size) {
sort_value->value = field->report_string = ""; sort_value->value = field->report_string = "";
sort_value->items[1].pos = 0; sort_value->items[0].pos = 0;
sort_value->items[1].len = 0; sort_value->items[0].len = 0;
field->sort_value = sort_value; field->sort_value = sort_value;
return 1; return 1;
} }