Disallow newlines in LOG target --log-prefix
PATCH 1/1 Disallow newlines in LOG target --log-prefix
As reported in bugzilla, iptables currently does not complain about the following:
# iptables -A foo -j LOG --log-prefix 'asdfasdfa asdf'
Patch below makes it complain, and closes bugzilla #312.
Phil
extensions/libip6t_LOG.c +4 -0
@@ -134,6 +134,10 @@"Maximum prefix length %u for --log-prefix" , (unsigned int)sizeof(loginfo->prefix) - 1); +if (strlen (optarg) !=strlen (strtok (optarg,"\n" ))) +exit_error (PARAMETER_PROBLEM , +"Newlines not allowed in --log-prefix" ); +strcpy (loginfo->prefix, optarg); *flags |=IP6T_LOG_OPT_PREFIX ;break ;
extensions/libipt_LOG.c +4 -0
@@ -143,6 +143,10 @@"Maximum prefix length %u for --log-prefix" , (unsigned int)sizeof(loginfo->prefix) - 1); +if (strlen (optarg) !=strlen (strtok (optarg,"\n" ))) +exit_error (PARAMETER_PROBLEM , +"Newlines not allowed in --log-prefix" ); +strcpy (loginfo->prefix, optarg); *flags |=IPT_LOG_OPT_PREFIX ;break ;
Thanks again, Phil.
Quoted 7 lines · Phil Oester
As reported in bugzilla, iptables currently does not complain about the following:
# iptables -A foo -j LOG --log-prefix 'asdfasdfa asdf'Patch below makes it complain, and closes bugzilla #312.
Sending extensions/libip6t_LOG.c
Sending extensions/libipt_LOG.c
Transmitting file data ..
Committed revision 3819.
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie