From dcdec4d0c7ea5f0b3fa414d3c509c4a5d4f7276e Mon Sep 17 00:00:00 2001 From: Juan Jose Nicola Date: Wed, 10 Feb 2021 09:39:23 -0600 Subject: [PATCH] Fix issues discovered with clang compiler --- CHANGELOG.md | 1 + nasl/nasl_crypto2.c | 20 +++++++++++++------- src/openvas.c | 1 - 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a150b0aa..ab286ad2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed ### Fixed +- Fix issues discovered with clang compiler. [#654](https://github.com/greenbone/openvas/pull/654) - Fix gcc-9 adn gcc-10 warnings. [#655](https://github.com/greenbone/openvas/pull/655) ### Removed diff --git a/nasl/nasl_crypto2.c b/nasl/nasl_crypto2.c index 92e99ff6d..390035de3 100644 --- a/nasl/nasl_crypto2.c +++ b/nasl/nasl_crypto2.c @@ -1626,9 +1626,9 @@ encrypt_stream_data (lex_ctxt *lexic, int cipher, const char *caller_func) if (!data || datalen <= 0) { nasl_perror (lexic, - "Syntax: encrypt_stream_data (called from " + "Syntax: %s (called from " "%s): Missing data argument", - caller_func); + __func__, caller_func); return NULL; } @@ -1642,7 +1642,14 @@ encrypt_stream_data (lex_ctxt *lexic, int cipher, const char *caller_func) tmp = g_memdup (data, datalen); tmplen = datalen; } - + else + { + nasl_perror (lexic, + "Syntax: %s (called from " + "%s): invalid cipher", + __func__, caller_func); + return NULL; + } result = g_malloc0 (resultlen); if ((error = gcry_cipher_encrypt (hd, result, resultlen, tmp, tmplen))) { @@ -1663,10 +1670,9 @@ encrypt_stream_data (lex_ctxt *lexic, int cipher, const char *caller_func) /** * @brief Nasl function to delete a cipher item from the cipher table. * - * @param[in] cipher The cipher algorithm. It must be the same used for the - * handler. It is used to prepare the data. Only GCRY_CIPHER_ARCFOUR is - * currently supported. - * @return Returns the encrypted data on success. Otherwise NULL. + * @param[in] cipher_id The cipher id to close + * + * @return Returns zero on success. Otherwise NULL. */ tree_cell * nasl_close_stream_cipher (lex_ctxt *lexic) diff --git a/src/openvas.c b/src/openvas.c index b6950706f..9bcdeb7fc 100644 --- a/src/openvas.c +++ b/src/openvas.c @@ -94,7 +94,6 @@ int global_max_checks = 10; */ GSList *log_config = NULL; -static volatile int loading_stop_signal = 0; static volatile int termination_signal = 0; static char *global_scan_id = NULL;