From 08ea4d87f6c5db1ce68ef58040a35271358fa6d8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 7 Apr 2015 09:08:32 +0200 Subject: 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 --- openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'openbsc') 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"; -- cgit v1.2.3