fix format specifier for netfilter log targets
Subsystems (3)
PATCH 1/1 fix format specifier for netfilter log targets
The prefix argument for nf_log_packet is a format specifier, so don't pass the user defined string directly to it.
Index: linux-2.6.x/net/ipv4/netfilter/ipt_LOG.c
===================================================================
RCS file: /cvs/sw/linux-2.6.x/net/ipv4/netfilter/ipt_LOG.c,v retrieving revision 1.1.1.16
net/ipv4/netfilter/ipt_LOG.c +1 -1
@@ -427,7 +427,7 @@ ipt_log_target(struct sk_buff **pskb,if (loginfo->logflags &IPT_LOG_NFLOG )nf_log_packet (PF_INET , hooknum, *pskb, in, out, &li, - loginfo->prefix); +"%s" , loginfo->prefix);else ipt_log_packet (PF_INET , hooknum, *pskb, in, out, &li, loginfo->prefix);
Index: linux-2.6.x/net/ipv6/netfilter/ip6t_LOG.c
===================================================================
RCS file: /cvs/sw/linux-2.6.x/net/ipv6/netfilter/ip6t_LOG.c,v retrieving revision 1.1.1.14
net/ipv6/netfilter/ip6t_LOG.c +1 -1
@@ -438,7 +438,7 @@ ip6t_log_target(struct sk_buff **pskb,if (loginfo->logflags &IP6T_LOG_NFLOG )nf_log_packet (PF_INET6 , hooknum, *pskb, in, out, &li, - loginfo->prefix); +"%s" , loginfo->prefix);else ip6t_log_packet (PF_INET6 , hooknum, *pskb, in, out, &li, loginfo->prefix);
Index: linux-2.6.x/net/bridge/netfilter/ebt_log.c
===================================================================
RCS file: /cvs/sw/linux-2.6.x/net/bridge/netfilter/ebt_log.c,v retrieving revision 1.1.1.9
net/bridge/netfilter/ebt_log.c +1 -1
@@ -168,7 +168,7 @@ static void ebt_log(const struct sk_buffif (info->bitmask &EBT_LOG_NFLOG )nf_log_packet (PF_BRIDGE , hooknr, skb, in, out, &li, - info->prefix); +"%s" , info->prefix);else ebt_log_packet (PF_BRIDGE , hooknr, skb, in, out, &li, info->prefix);
Quoted 2 lines · Philip Craig
The prefix argument for
nf_log_packetis a format specifier, so don't pass the user defined string directly to it.
This part is going to get removed again, but for now it seems reasonable anyway. Thanks.