mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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) {
|
while ((key = va_arg(args, char *)) != NULL) {
|
||||||
|
|
||||||
if (strlen(key) < 3) {
|
if (strlen(key) < 3 || key[1] != ':') {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("argument key '%s' is too short, missing type prefix"),
|
_("argument key '%s' is too short or malformed"),
|
||||||
key);
|
key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user