Commit f70ba7cb authored by Pavel Hrdina's avatar Pavel Hrdina

util: fix virtDBusUtilDecodeUUID

This function is supposed to convert ASCII character into its hex
representation, however the current implementation was wrong because
the first comparison would be false for all printable characters.  In
most cases it worked but for example '$' which is 0x24 in HEX would be
incorrectly converted to 0x2[ which is obviously wrong.

Resolves: Pavel Hrdina's avatarPavel Hrdina <>
parent d512fd8c
......@@ -182,11 +182,12 @@ virtDBusUtilDecodeUUID(const gchar *uuid)
static guchar
virtDBusUtilNumToHexchar(const guchar c)
virtDBusUtilNumToHexchar(const guchar n)
guchar c = n & 0x0f;
if (c < 10)
return '0' + c;
return 'a' + (c & 0x0f) - 10;
return 'a' + c - 10;
static guchar
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment