From 4a13a2b1babc2de9ded5bed9a8e8f6740a32cd7e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 18 Aug 2014 11:46:38 +0200 Subject: [PATCH] uuid: check the uuid string size --- src/uuid.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/uuid.c b/src/uuid.c index 1fd6a540..959fc185 100644 --- a/src/uuid.c +++ b/src/uuid.c @@ -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);