1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

bhyve: avoid an empty passthru config value

pci_parse_legacy_config splits the options string by comma characters.
strchr returns a pointer to the first occurence of a character. In that
case, it's a comma. So, pci_parse_legacy_config will stop at the first
character and creates a new config node with a name of NULL.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D34600

(cherry picked from commit 3256b7ca36)
This commit is contained in:
Corvin Köhne 2022-04-01 10:20:55 +02:00 committed by Emmanuel Vadot
parent 718cb64a1f
commit 469a4e669d

View File

@ -669,7 +669,12 @@ passthru_legacy_config(nvlist_t *nvl, const char *opts)
snprintf(value, sizeof(value), "%d", func);
set_config_value_node(nvl, "func", value);
return (pci_parse_legacy_config(nvl, strchr(opts, ',')));
opts = strchr(opts, ',');
if (opts == NULL) {
return (0);
}
return pci_parse_legacy_config(nvl, opts + 1);
}
static int