patch-2.1.120 linux/net/ipv4/ip_fw.c
Next file: linux/net/ipv4/ip_gre.c
Previous file: linux/net/ipv4/ip_fragment.c
Back to the patch index
Back to the overall index
- Lines: 54
- Date:
Tue Sep 1 10:54:37 1998
- Orig file:
v2.1.119/linux/net/ipv4/ip_fw.c
- Orig date:
Sun Jul 26 11:57:20 1998
diff -u --recursive --new-file v2.1.119/linux/net/ipv4/ip_fw.c linux/net/ipv4/ip_fw.c
@@ -427,18 +427,15 @@
printk("\n");
}
-/* function for checking chain labels for user space. Makes sure that
- * there are no special characters in the string */
+/* function for checking chain labels for user space. */
static int check_label(ip_chainlabel label)
{
unsigned int i;
-
- for (i = 0; i < IP_FW_MAX_LABEL_LENGTH + 1 && label[i]; i++)
- if (label[i] <= ' ')
- return 0;
- if (i == IP_FW_MAX_LABEL_LENGTH+1)
- return 0;
- return 1;
+ /* strlen must be < IP_FW_MAX_LABEL_LENGTH. */
+ for (i = 0; i < IP_FW_MAX_LABEL_LENGTH + 1; i++)
+ if (label[i] == '\0') return 1;
+
+ return 0;
}
/* This function returns a pointer to the first chain with a label
@@ -1098,6 +1095,9 @@
{
struct ip_chain *tmp;
+ if (!check_label(label))
+ return EINVAL;
+
FWC_HAVE_LOCK(fwc_wlocks);
for (tmp = ip_fw_chains; tmp->next; tmp = tmp->next)
if (strcmp(tmp->label,label) == 0)
@@ -1512,14 +1512,14 @@
"%9s " /* Chain name */
"%08lX/%08lX->%08lX/%08lX " /* Source & Destination IPs */
"%.16s " /* Interface */
- "%hX %hX " /* fw_flg and fw_invflg fields */
- "%hu " /* Protocol */
+ "%X %X " /* fw_flg and fw_invflg fields */
+ "%u " /* Protocol */
"%-9u %-9u %-9u %-9u " /* Packet & byte counters */
- "%hu-%hu %hu-%hu " /* Source & Dest port ranges */
+ "%u-%u %u-%u " /* Source & Dest port ranges */
"A%02X X%02X " /* TOS and and xor masks */
"%08X " /* Redirection port */
"%u " /* fw_mark field */
- "%hu " /* output size */
+ "%u " /* output size */
"%9s\n", /* Target */
chainlabel,
ntohl(rule->ipfw.fw_src.s_addr),
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov