1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-06 17:18:29 +03:00

Do not crash for NULL sort_key

Guard against NULL pointer for sort_key and let it behave like an empty
string would have been passed in (i.e. no key).
This commit is contained in:
Zdenek Kabelac 2012-02-10 14:00:07 +00:00
parent 36ddbdbbe2
commit 2c711a2502
2 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.70 -
===================================
Do not crash for dm_report_init() sort_key == NULL and behave like "".
Return error for failing allocation in dm_asprintf().
Add missing test for failing allocation in dm_realloc() code.
Add test for memory allocation failures in regex matcher code.

View File

@ -541,6 +541,9 @@ static int _parse_keys(struct dm_report *rh, const char *keys,
const char *ws; /* Word start */
const char *we = keys; /* Word end */
if (!keys)
return 1;
while (*we) {
/* Allow consecutive commas */
while (*we && *we == ',')