diff mbox series

[1/1] firewall3: remove last remaining sprintf()

Message ID 20210219204935.88612-1-philipp@redfish-solutions.com
State Accepted
Headers show
Series [1/1] firewall3: remove last remaining sprintf() | expand

Commit Message

Philip Prindeville Feb. 19, 2021, 8:49 p.m. UTC
From: Philip Prindeville <philipp@redfish-solutions.com>

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
---
 iptables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Rosen Penev Feb. 23, 2021, 4:35 a.m. UTC | #1
On Fri, Feb 19, 2021 at 12:52 PM Philip Prindeville
<philipp@redfish-solutions.com> wrote:
>
> From: Philip Prindeville <philipp@redfish-solutions.com>
>
> Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Reviewed-by: Rosen Penev <rosenp@gmail.com>
> ---
>  iptables.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/iptables.c b/iptables.c
> index 9e8fa743c99f84222307128047d40d657916aa75..49b34394dfec4df361ec1cf6778cade831454c7c 100644
> --- a/iptables.c
> +++ b/iptables.c
> @@ -1022,7 +1022,7 @@ fw3_ipt_rule_icmptype(struct fw3_ipt_rule *r, struct fw3_icmptype *icmp)
>  #endif
>         {
>                 if (icmp->code_min == 0 && icmp->code_max == 0xFF)
> -                       sprintf(buf, "%u", icmp->type);
> +                       snprintf(buf, sizeof(buf), "%u", icmp->type);
>                 else
>                         snprintf(buf, sizeof(buf), "%u/%u", icmp->type, icmp->code_min);
>
> --
> 2.25.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/iptables.c b/iptables.c
index 9e8fa743c99f84222307128047d40d657916aa75..49b34394dfec4df361ec1cf6778cade831454c7c 100644
--- a/iptables.c
+++ b/iptables.c
@@ -1022,7 +1022,7 @@  fw3_ipt_rule_icmptype(struct fw3_ipt_rule *r, struct fw3_icmptype *icmp)
 #endif
 	{
 		if (icmp->code_min == 0 && icmp->code_max == 0xFF)
-			sprintf(buf, "%u", icmp->type);
+			snprintf(buf, sizeof(buf), "%u", icmp->type);
 		else
 			snprintf(buf, sizeof(buf), "%u/%u", icmp->type, icmp->code_min);