error: ‘%u’ directive writing between 1 and 10 bytes into a region of size
between 7 and 11 [-Werror=format-overflow=]
sprintf(buf, "%u-%u", port->port_min, port->port_max);
^~
note: directive argument in the range [0,
2147483647]
sprintf(buf, "%u-%u", port->port_min, port->port_max);
^~~~~~~
note: ‘sprintf’ output between 4 and 17 bytes into a destination of size
13
sprintf(buf, "%u-%u", port->port_min, port->port_max);
Signed-off-by: Rosen Penev <rosenp@gmail.com>
if (sp->port_min == sp->port_max)
sprintf(buf, "%u", sp->port_min);
else
if (sp->port_min == sp->port_max)
sprintf(buf, "%u", sp->port_min);
else
- sprintf(buf, "%u:%u", sp->port_min, sp->port_max);
+ snprintf(buf, sizeof(buf), "%u:%u", sp->port_min, sp->port_max);
fw3_ipt_rule_addarg(r, sp->invert, "--sport", buf);
}
fw3_ipt_rule_addarg(r, sp->invert, "--sport", buf);
}
if (dp->port_min == dp->port_max)
sprintf(buf, "%u", dp->port_min);
else
if (dp->port_min == dp->port_max)
sprintf(buf, "%u", dp->port_min);
else
- sprintf(buf, "%u:%u", dp->port_min, dp->port_max);
+ snprintf(buf, sizeof(buf), "%u:%u", dp->port_min, dp->port_max);
fw3_ipt_rule_addarg(r, dp->invert, "--dport", buf);
}
fw3_ipt_rule_addarg(r, dp->invert, "--dport", buf);
}
if (icmp->code6_min == 0 && icmp->code6_max == 0xFF)
sprintf(buf, "%u", icmp->type6);
else
if (icmp->code6_min == 0 && icmp->code6_max == 0xFF)
sprintf(buf, "%u", icmp->type6);
else
- sprintf(buf, "%u/%u", icmp->type6, icmp->code6_min);
+ snprintf(buf, sizeof(buf), "%u/%u", icmp->type6, icmp->code6_min);
fw3_ipt_rule_addarg(r, icmp->invert, "--icmpv6-type", buf);
}
fw3_ipt_rule_addarg(r, icmp->invert, "--icmpv6-type", buf);
}
if (icmp->code_min == 0 && icmp->code_max == 0xFF)
sprintf(buf, "%u", icmp->type);
else
if (icmp->code_min == 0 && icmp->code_max == 0xFF)
sprintf(buf, "%u", icmp->type);
else
- sprintf(buf, "%u/%u", icmp->type, icmp->code_min);
+ snprintf(buf, sizeof(buf), "%u/%u", icmp->type, icmp->code_min);
fw3_ipt_rule_addarg(r, icmp->invert, "--icmp-type", buf);
}
fw3_ipt_rule_addarg(r, icmp->invert, "--icmp-type", buf);
}
if (port->port_min == port->port_max)
sprintf(buf, "%u", port->port_min);
else
if (port->port_min == port->port_max)
sprintf(buf, "%u", port->port_min);
else
- sprintf(buf, "%u-%u", port->port_min, port->port_max);
+ snprintf(buf, sizeof(buf), "%u-%u", port->port_min, port->port_max);
fw3_ipt_rule_addarg(r, false, "--to-ports", buf);
}
fw3_ipt_rule_addarg(r, false, "--to-ports", buf);
}