mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cleanup: never return uninitialized buffer
Coverity noticed this function may return untouched buffer, however in this state can't really happen, but anyway ensure on error path the buffer will have zero lenght string.
This commit is contained in:
parent
8f518cf197
commit
e5356eeba1
@ -602,8 +602,10 @@ static int _cfg_def_make_path(char *buf, size_t buf_size, int id, cfg_def_item_t
|
||||
int parent_id = item->parent;
|
||||
int count, n;
|
||||
|
||||
if (id == parent_id)
|
||||
if (id == parent_id) {
|
||||
buf[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
count = _cfg_def_make_path(buf, buf_size, parent_id, cfg_def_get_item_p(parent_id), xlate);
|
||||
if ((n = dm_snprintf(buf + count, buf_size - count, "%s%s%s%s",
|
||||
|
Loading…
Reference in New Issue
Block a user