]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
uuid: check the uuid string size
authorJaroslav Kysela <perex@perex.cz>
Mon, 18 Aug 2014 09:46:38 +0000 (11:46 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 18 Aug 2014 09:46:38 +0000 (11:46 +0200)
src/uuid.c

index 1fd6a54057705a65a993bcaa9df93d9da802f6c6..959fc185fba562a2de3ae022b6febae2eb37cb81 100644 (file)
@@ -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);