mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
Allow surrounding whitespace in uuid
* src/util/uuid.c: extend virUUIDParse to allow leading and trailing spaces in UUIDs
This commit is contained in:
parent
2c8eb68969
commit
ca18b7108d
@ -146,9 +146,13 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) {
|
||||
|
||||
/*
|
||||
* do a liberal scan allowing '-' and ' ' anywhere between character
|
||||
* pairs as long as there is 32 of them in the end.
|
||||
* pairs, and surrounding whitespace, as long as there are exactly
|
||||
* 32 hexadecimal digits the end.
|
||||
*/
|
||||
cur = uuidstr;
|
||||
while (c_isspace(*cur))
|
||||
cur++;
|
||||
|
||||
for (i = 0;i < VIR_UUID_BUFLEN;) {
|
||||
uuid[i] = 0;
|
||||
if (*cur == 0)
|
||||
@ -171,6 +175,12 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid) {
|
||||
cur++;
|
||||
}
|
||||
|
||||
while (*cur) {
|
||||
if (!c_isspace(*cur))
|
||||
goto error;
|
||||
cur++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user