Changeset View
Changeset View
Standalone View
Standalone View
sbin/ipfw/ipfw2.c
Show First 20 Lines • Show All 4,668 Lines • ▼ Show 20 Lines | case TOK_GID: | ||||
cmd->len |= F_INSN_SIZE(ipfw_insn_u32); | cmd->len |= F_INSN_SIZE(ipfw_insn_u32); | ||||
av++; | av++; | ||||
} | } | ||||
break; | break; | ||||
case TOK_JAIL: | case TOK_JAIL: | ||||
NEED1("jail requires argument"); | NEED1("jail requires argument"); | ||||
{ | { | ||||
char *end; | |||||
int jid; | int jid; | ||||
cmd->opcode = O_JAIL; | cmd->opcode = O_JAIL; | ||||
/* | |||||
* If av is a number, then we'll just pass it as-is. If | |||||
* it's a name, try to resolve that to a jid. | |||||
* | |||||
* We save the jail_getid(3) call for a fallback because | |||||
* it entails an unconditional trip to the kernel to | |||||
* either validate a jid or resolve a name to a jid. | |||||
* This specific token doesn't currently require a | |||||
* jid to be an active jail, so we save a transition | |||||
* by simply using a number that we're given. | |||||
*/ | |||||
jid = strtoul(*av, &end, 10); | |||||
if (*av == '\0' || *end != '\0') { | |||||
ae: It seems *av can not be '\0' here. The NEED1() macro does check for required argument. | |||||
kevansAuthorUnsubmitted Done Inline ActionsAh, true enough! I'll just drop that clause pre-commit without another review iteration of that's alright with you. kevans: Ah, true enough! I'll just drop that clause pre-commit without another review iteration of… | |||||
jid = jail_getid(*av); | jid = jail_getid(*av); | ||||
if (jid < 0) | if (jid < 0) | ||||
errx(EX_DATAERR, "%s", jail_errmsg); | errx(EX_DATAERR, "%s", jail_errmsg); | ||||
} | |||||
cmd32->d[0] = (uint32_t)jid; | cmd32->d[0] = (uint32_t)jid; | ||||
cmd->len |= F_INSN_SIZE(ipfw_insn_u32); | cmd->len |= F_INSN_SIZE(ipfw_insn_u32); | ||||
av++; | av++; | ||||
} | } | ||||
break; | break; | ||||
case TOK_ESTAB: | case TOK_ESTAB: | ||||
fill_cmd(cmd, O_ESTAB, 0, 0); | fill_cmd(cmd, O_ESTAB, 0, 0); | ||||
▲ Show 20 Lines • Show All 913 Lines • Show Last 20 Lines |
It seems *av can not be '\0' here. The NEED1() macro does check for required argument.