aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-07 09:08:32 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-04-07 09:10:05 +0200
commit08ea4d87f6c5db1ce68ef58040a35271358fa6d8 (patch)
tree5f2d265141ba46b749ea920a08ad9006333298da
parent0ac00c15b9fd667da80670440916ce2982eece20 (diff)
nat: Check for the access list in set command as well
I omitted the check as this was already done by the verify function for this command. Please Coverity and do the check again even if it is not necessary. I begin to doubt the usage of a "dedicated" verify method as well. Silences: Coverity CID 1293150
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
index 54e1dc4c2..4b59b404f 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -404,11 +404,18 @@ static int get_net_cfg_acc_cmd(struct ctrl_cmd *cmd, void *data)
static int set_net_cfg_acc_cmd(struct ctrl_cmd *cmd, void *data)
{
const char *access_name = extract_acc_name(cmd->variable);
- struct bsc_nat_acc_lst *acc = bsc_nat_acc_lst_find(g_nat, access_name);
+ struct bsc_nat_acc_lst *acc;
struct bsc_nat_acc_lst_entry *entry;
const char *value = cmd->value;
int rc;
+ /* Should have been caught by verify_net_cfg_acc_cmd */
+ acc = bsc_nat_acc_lst_find(g_nat, access_name);
+ if (!acc) {
+ cmd->reply = "Access list not found";
+ return CTRL_CMD_ERROR;
+ }
+
entry = bsc_nat_acc_lst_entry_create(acc);
if (!entry) {
cmd->reply = "OOM";