initial import
[patches.git] / iptables-log-prefix-no-empty-strings.patch
1 http://bugs.gentoo.org/148169
2
3 --- extensions/libip6t_LOG.c
4 +++ extensions/libip6t_LOG.c
5 @@ -143,6 +143,10 @@ parse(int c, char **argv, int invert, un
6 "Maximum prefix length %u for --log-prefix",
7 (unsigned int)sizeof(loginfo->prefix) - 1);
8
9 + if (strlen(optarg) == 0)
10 + exit_error(PARAMETER_PROBLEM,
11 + "No prefix specified for --log-prefix");
12 +
13 if (strlen(optarg) != strlen(strtok(optarg, "\n")))
14 exit_error(PARAMETER_PROBLEM,
15 "Newlines not allowed in --log-prefix");
16 --- extensions/libipt_LOG.c
17 +++ extensions/libipt_LOG.c
18 @@ -143,6 +143,10 @@ parse(int c, char **argv, int invert, un
19 "Maximum prefix length %u for --log-prefix",
20 (unsigned int)sizeof(loginfo->prefix) - 1);
21
22 + if (strlen(optarg) == 0)
23 + exit_error(PARAMETER_PROBLEM,
24 + "No prefix specified for --log-prefix");
25 +
26 if (strlen(optarg) != strlen(strtok(optarg, "\n")))
27 exit_error(PARAMETER_PROBLEM,
28 "Newlines not allowed in --log-prefix");
29 --- extensions/libipt_ULOG.c
30 +++ extensions/libipt_ULOG.c
31 @@ -110,6 +110,14 @@ static int parse(int c, char **argv, int
32 "Maximum prefix length %u for --ulog-prefix",
33 (unsigned int)sizeof(loginfo->prefix) - 1);
34
35 + if (strlen(optarg) == 0)
36 + exit_error(PARAMETER_PROBLEM,
37 + "No prefix specified for --ulog-prefix");
38 +
39 + if (strlen(optarg) != strlen(strtok(optarg, "\n")))
40 + exit_error(PARAMETER_PROBLEM,
41 + "Newlines not allowed in --ulog-prefix");
42 +
43 strcpy(loginfo->prefix, optarg);
44 *flags |= IPT_LOG_OPT_PREFIX;
45 break;