summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_icmp.c
diff options
context:
space:
mode:
authorlaforge <laforge>2001-07-23 02:14:22 +0000
committerlaforge <laforge>2001-07-23 02:14:22 +0000
commit1eef903c702ef52efcbf5e8b04117b3cec591922 (patch)
tree6b34d5dfc6bca2aff38c5e6f406c0f1700fe8836 /extensions/libipt_icmp.c
parent24824b73d48ba0590401934597f67b0e982b900d (diff)
further fixes of string_to_number fixes
Diffstat (limited to 'extensions/libipt_icmp.c')
-rw-r--r--extensions/libipt_icmp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/extensions/libipt_icmp.c b/extensions/libipt_icmp.c
index 6390518..a8b6bd1 100644
--- a/extensions/libipt_icmp.c
+++ b/extensions/libipt_icmp.c
@@ -133,7 +133,7 @@ parse_icmp(const char *icmptype, u_int8_t *type, u_int8_t code[])
} else {
char *slash;
char buffer[strlen(icmptype) + 1];
- int number;
+ unsigned int number;
strcpy(buffer, icmptype);
slash = strchr(buffer, '/');
@@ -141,14 +141,12 @@ parse_icmp(const char *icmptype, u_int8_t *type, u_int8_t code[])
if (slash)
*slash = '\0';
- number = string_to_number(buffer, 0, 255);
- if (number == -1)
+ if (string_to_number(buffer, 0, 255, &number) == -1)
exit_error(PARAMETER_PROBLEM,
"Invalid ICMP type `%s'\n", buffer);
*type = number;
if (slash) {
- number = string_to_number(slash+1, 0, 255);
- if (number == -1)
+ if (string_to_number(slash+1, 0, 255, &number) == -1)
exit_error(PARAMETER_PROBLEM,
"Invalid ICMP code `%s'\n",
slash+1);