[OpenWrt-Devel] [PATCH] fw3: robustify flow table detection.

Petr Štetiar ynezz at true.cz
Sat Jan 18 08:01:23 EST 2020


Rui Salvaterra <rsalvaterra at gmail.com> [2020-01-16 21:16:43]:

Hi,

> +fw3_has_target(const char *target)
> +{
> +	FILE *f;
> +
> +	char line[12];
> +	bool seen = false;
> +
> +	const char *path = "/proc/net/ip_tables_targets";
> +
> +	if (!(f = fopen(path, "r")))
> +		return false;
> +
> +	while (fgets(line, sizeof(line), f))
> +	{
> +		if (!strncmp(line, target, strlen(target)))

This doesn't seem right to me in case target > 12,
MIN(sizeof(line), strlen(target)) perhaps?

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list