Skip to contentSkip to conversation

fix format specifier for netfilter log targets

PATCH In review Philip Craig 2 participants 2 messages May 15, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
diff -u -p -r1.1.1.16 ipt_LOG.c
@@ -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
diff -u -p -r1.1.1.14 ip6t_LOG.c
@@ -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
diff -u -p -r1.1.1.9 ebt_log.c
@@ -168,7 +168,7 @@ static void ebt_log(const struct sk_buff
 
 	if (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);
#1 lore raw
Quoted 2 lines · Philip Craig

The prefix argument for nf_log_packet is 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.