mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
virJSONValueObjectAddVArgs: Add check for presence of the ':' separator
Enforce that the ':' separator between the key and value is always present. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
eb5b7722ea
commit
acf4159556
@ -161,9 +161,9 @@ virJSONValueObjectAddVArgs(virJSONValue *obj,
|
||||
|
||||
while ((key = va_arg(args, char *)) != NULL) {
|
||||
|
||||
if (strlen(key) < 3) {
|
||||
if (strlen(key) < 3 || key[1] != ':') {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("argument key '%s' is too short, missing type prefix"),
|
||||
_("argument key '%s' is too short or malformed"),
|
||||
key);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user