uuid: check the uuid string size
This commit is contained in:
parent
4dc87895d1
commit
4a13a2b1ba
1 changed files with 4 additions and 0 deletions
|
@ -107,6 +107,10 @@ uuid_init_bin ( tvh_uuid_t *u, const char *str )
|
|||
{
|
||||
memset(u, 0, sizeof(tvh_uuid_t));
|
||||
if (str) {
|
||||
if (strlen(str) != UUID_HEX_SIZE - 1) {
|
||||
tvherror("uuid", "wrong uuid size");
|
||||
exit(1);
|
||||
}
|
||||
return hex2bin(u->bin, sizeof(u->bin), str);
|
||||
} else if (read(fd, u->bin, sizeof(u->bin)) != sizeof(u->bin)) {
|
||||
tvherror("uuid", "failed to read from %s", RANDOM_PATH);
|
||||
|
|
Loading…
Add table
Reference in a new issue