uuid: Tighten uuid parse
authorFam Zheng <famz@redhat.com>
Wed, 21 Sep 2016 04:27:23 +0000 (12:27 +0800)
committerFam Zheng <famz@redhat.com>
Fri, 23 Sep 2016 03:42:52 +0000 (11:42 +0800)
commit0d6ae94783b35a5c42d88872d1adb523f5fcc6f3
treeba69bbf2e1483ccd91d54f85d8d35774946f2918
parent9c5ce8db2e5c2769ed2fd3d91928dd1853b5ce7c
uuid: Tighten uuid parse

sscanf is relatively loose (tolerate) on some invalid formats that we
should fail instead of generating a wrong uuid structure, like with
whitespaces and short strings.

Add and use a helper function to first check the format.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Message-Id: <1474432046-325-11-git-send-email-famz@redhat.com>
util/uuid.c