1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Fix uuid_from_num() buffer overrun.

This commit is contained in:
Alasdair Kergon 2006-05-10 16:42:03 +00:00
parent b8d32a0d33
commit 3503d4b72c
4 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.06 -
=================================
Fix uuid_from_num() buffer overrun.
Make SIZE_SHORT the default for display_size().
Fix some memory leaks in error paths found by coverity.
Use C99 struct initialisers.

View File

@ -153,8 +153,10 @@ static int _munge_formats(struct pv_disk *pvd)
}
/* If UUID is missing, create one */
if (pvd->pv_uuid[0] == '\0')
if (pvd->pv_uuid[0] == '\0') {
uuid_from_num((char *)pvd->pv_uuid, pvd->pv_number);
pvd->pv_uuid[ID_LEN] = '\0';
}
return 1;
}

View File

@ -33,7 +33,7 @@ const char *text_vgname_import(const struct format_type *fmt,
{
struct config_tree *cft;
struct text_vg_version_ops **vsn;
const char *vgname;
const char *vgname = NULL;
static int _text_import_initialised = 0;

View File

@ -40,8 +40,6 @@ void uuid_from_num(char *uuid, uint32_t num)
uuid[i - 1] = _c[num % (sizeof(_c) - 1)];
num /= sizeof(_c) - 1;
}
uuid[ID_LEN] = '\0';
}
int lvid_from_lvnum(union lvid *lvid, struct id *vgid, uint32_t lv_num)