From: Savinay Dharmappa Date: Fri, 13 Dec 2019 11:49:55 +0000 (+0000) Subject: examples/ipsec-secgw: fix crash on unsupported algo X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=71d9e6fb2a0d8709e97384b30d81b3bff35da16f;p=dpdk.git examples/ipsec-secgw: fix crash on unsupported algo If algo is NULL set the status to error and return. This change prevent crashing of ipsec-secgw application when a specific cipher/auth/aead algo are not supported by application. Fixes: 0d547ed03717 ("examples/ipsec-secgw: support configuration file") Cc: stable@dpdk.org Signed-off-by: Savinay Dharmappa Acked-by: Konstantin Ananyev --- diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 7f046e3ed7..c75a5a15f5 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -314,6 +314,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->cipher_algo = algo->algo; rule->block_size = algo->block_size; rule->iv_len = algo->iv_len; @@ -378,6 +381,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->auth_algo = algo->algo; rule->auth_key_len = algo->key_len; rule->digest_len = algo->digest_len; @@ -433,6 +439,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->aead_algo = algo->algo; rule->cipher_key_len = algo->key_len; rule->digest_len = algo->digest_len;