mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
python: Check for NULL value before constructing string property
When retrieving a property value that is a string, if the character pointer in C was NULL, we would segfault. This change checks for non-null before creating a python string representation. In the case where the character pointer is NULL we will return a python 'None' for the value. Signed-off-by: Tony Asleson <tasleson@redhat.com>
This commit is contained in:
parent
c21f1ba07a
commit
e8c11c7df0
@ -877,7 +877,11 @@ static PyObject *get_property(struct lvm_property_value *prop)
|
||||
PyTuple_SET_ITEM(pytuple, 0, Py_BuildValue("K", prop->value.integer));
|
||||
}
|
||||
} else {
|
||||
if ( prop->value.string ) {
|
||||
PyTuple_SET_ITEM(pytuple, 0, PYSTRTYPE_FROMSTRING(prop->value.string));
|
||||
} else {
|
||||
PyTuple_SET_ITEM(pytuple, 0, Py_None);
|
||||
}
|
||||
}
|
||||
|
||||
if (prop->is_settable)
|
||||
|
Loading…
Reference in New Issue
Block a user