Messages in this thread Patch in this message | | | From | Paul Rusty Russell <> | Subject | [PATCH] Overzealous name sanity check in ip_fw.c breaks int'l chars | Date | Tue, 01 Sep 1998 19:43:22 +0930 |
| |
Check for special characters should be unsigned char; breaks on high bit chars. Check is bogus anyway; deleted.
Also, check should be called on chain creation.
--- linux/net/ipv4/ip_fw.c.~1~ Tue Jul 28 19:06:16 1998 +++ linux/net/ipv4/ip_fw.c Tue Sep 1 19:28:56 1998 @@ -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 @@ -1097,6 +1094,9 @@ static int create_chain(ip_chainlabel label) { 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)
-- .sig lost in the mail.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |