2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

dpctl: Fix dereferencing null pointer in parse_ct_limit_zones().

Command with empty string following "dpctl/ct-get-limits zone="
such as "ovs-appctl dpctl/ct-get-limits zone=" will cause
parse_ct_limit_zones() dereferencing null.

Signed-off-by: Zhiqi Chen <chenzhiqi.123@bytedance.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Zhiqi Chen
2023-05-10 16:35:37 +08:00
committed by Ilya Maximets
parent cd608cf96e
commit ffb8b743bb
2 changed files with 19 additions and 2 deletions

View File

@@ -2206,7 +2206,7 @@ parse_ct_limit_zones(const char *argv, struct ovs_list *zone_limits,
argcopy = xstrdup(argv + 5);
next_zone = strtok_r(argcopy, ",", &save_ptr);
do {
while (next_zone != NULL) {
if (ovs_scan(next_zone, "%"SCNu16, &zone)) {
ct_dpif_push_zone_limit(zone_limits, zone, 0, 0);
} else {
@@ -2214,7 +2214,8 @@ parse_ct_limit_zones(const char *argv, struct ovs_list *zone_limits,
free(argcopy);
return EINVAL;
}
} while ((next_zone = strtok_r(NULL, ",", &save_ptr)) != NULL);
next_zone = strtok_r(NULL, ",", &save_ptr);
}
free(argcopy);
return 0;