Commit 53d810d9 authored by SZ Lin (林上智)'s avatar SZ Lin (林上智)

Import openvas-libraries_8.0.8.orig.tar.gz

parent cb4f4627
openvas-libraries 8.0.8 (2016-08-30)
This is the eighth maintenance release of the openvas-libraries 8.0 module for
the Open Vulnerability Assessment System 8 (OpenVAS-8).
This release adds support for the 'timeout_retry' preference, addresses a
number of memory leaks and similar errors and includes a number of smaller
fixes and improvements.
Many thanks to everyone who has contributed to this release:
Hani Benhabiles, Christian Fischer, Matthew Mundell, Timo Pollmeier and Michael
Wiegand.
Main changes compared to 8.0.7:
* Support for the 'timeout_retry' preference has been added, which can be used
to limit the number of retries after a connection to a socket has timed out.
* A number of memory leaks have been fixed.
* A bug which caused NASL arrays to be freed improperly causing memory
corruption under certain circumstances has been fixed.
* Compatibility with the LibSSH library has been improved.
* IPv6 support has been improved.
* Handling of unknown severity scores has been improved.
* Documentation has been updated.
* ECDSA public SSH keys are now handled correctly during export.
* Support for the SHA256 HMAC algorithm has been added.
* Support for SMBv2 signatures has been added.
* Support for getting the key size of a certificate public key has been added.
* Handling of attempts to connect to the redis KB has been improved.
* SNMP MIB handling has been improved.
* Handling of unknown escape sequences in NASL has been improved.
* Handling of slave connection errors has been improved.
* Network connection handling has been improved.
openvas-libraries 8.0.7 (2016-02-26)
This is the seventh maintenance release of the openvas-libraries 8.0 module for
......
......@@ -96,7 +96,7 @@ set (CPACK_PACKAGE_VERSION_MAJOR "8")
set (CPACK_PACKAGE_VERSION_MINOR "0")
# Use this scheme for stable releases:
set (CPACK_PACKAGE_VERSION_PATCH "7${SVN_REVISION}")
set (CPACK_PACKAGE_VERSION_PATCH "8${SVN_REVISION}")
set (CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Use this scheme for +betaN and +rcN releases:
#set (CPACK_PACKAGE_VERSION_PATCH "+beta1${SVN_REVISION}")
......
2016-08-30 Michael Wiegand <michael.wiegand@greenbone.net>
Preparing the openvas-libraries 8.0.8 release.
* CHANGES: Updated.
2016-08-30 Michael Wiegand <michael.wiegand@greenbone.net>
* nasl/nasl_cert.c: Add missing include.
2016-08-29 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r26123.
* nasl/nasl_cert.c (nasl_cert_query): Add key-size command to get the
public key size in bits.
2016-08-17 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r26027.
* misc/network.c (recv_line): Check if the socket was closed by the
sender.
2016-08-10 Matthew Mundell <matthew.mundell@greenbone.net>
Backport r25976.
* omp/omp.c (omp_create_target_ext): Use a separate return for
connection error.
2016-08-03 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25900.
* nasl/nasl_var.c (free_aray): Nullify hash_elt after free. Fixes
use-after-free.
2016-07-21 Michael Wiegand <michael.wiegand@greenbone.net>
Backport r25809 by Hani Benhabiles.
* nasl/nasl_grammar.y (mylex): Exit on unknown escape sequence error.
2016-07-12 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25147 and r25166.
* nasl/nasl_crypto.c (nasl_get_smb2_sign): New function.
* nasl/nasl_crypto.h: Add new function prototype.
* nasl/nasl_init.c (libfuncs): Add get_smb2_signature().
2016-06-09 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25478.
* nasl/nasl_snmp.c (snmpv3_get, snmpv1v2c_get): Set MIBS environment
variable to "".
2016-06-08 Matthew Mundell <matthew.mundell@greenbone.net>
Backport r25463.
* nasl/exec.c (cell2str): Use memcpy instead of strncpy, in case it is
not a string when type is DATA.
2016-06-08 Matthew Mundell <matthew.mundell@greenbone.net>
Backport r25462.
* nasl/exec.c (cell2str): In the STR and DATA case, copy only size
bytes from c->x.str_val instead of size + 1, because str_val may not
have the extra byte for the trailing NULL when type is DATA.
2016-05-31 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25434.
* nasl/nasl_builtin_find_service.c (plugin_run_find_service): Fix memory
leak.
2016-05-30 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25409, r25413 and r25415.
* misc/openvas_proctitle.c (proctitle_init): Fix memory leak.
* nasl/nasl_builtin_find_service.c (plugin_run_find_service): Fix memory
leak.
2016-05-30 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25381, r25395 and r25398.
* misc/network.c (ovas_scanner_context_new): Fix allocated memory size.
(set_ids_evasion_mode, open_stream_connection_ext): Fix memory leak.
(ovas_scanner_context_s): Add tls_session element.
(ovas_scanner_context_attach): Save context tls session.
* nasl/nasl_http.c (_http_req): Fix memory leak.
* nasl/nasl_misc_funcs.c (nasl_typeof): Fix smaller-by-one memory
allocation.
* misc/bpf_share.c (bpf_open_live), misc/plugutils.c (mark_post),
nasl/nasl_builtin_find_service.c (plugin_do_run): Fix memory leaks.
* imsc/plugutils.h: Constify function parameter.
* nasl/nasl_socket.c (nasl_recv): Fix off-by-one memory write.
2016-05-26 Matthew Mundell <matthew.mundell@greenbone.net>
Backport r25392.
* base/kb_redis.c (get_redis_ctx): Connect inside the retry loop, in
case the connection is lost between retries.
2016-04-20 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r25022.
* nasl/nasl_crypto.c (hmac_sha256, nasl_hmac_sha256): New functions.
* nasl/nasl_crypto.h: Add new function prototype.
* nasl/nasl_init.c (libfuncs): Add hmac_sha256() function.
2016-04-25 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r24813.
* misc/network.c (open_sock_tcp): Use timeout_retry preference to
specify the number of retries when a timeout occurs.
2016-04-15 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r24977.
* base/openvas_networking.c (openvas_ssh_public_from_private): Use
ssh_pki_key_ecdsa_name() when available.
2016-04-08 Michael Wiegand <michael.wiegand@greenbone.net>
* INSTALL: Update apt-get line for Debian 7 and add apt-get line for
Debian 8 as suggested by Christian Fischer.
2016-03-22 Timo Pollmeier <timo.pollmeier@greenbone.net>
Backport r23020.
* base/credentials.h (credentials_t): Add field default_severity.
2016-03-14 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r24640.
* misc/openvas_server.c (openvas_server_open_with_cert): Support IPv6
too.
2016-03-03 Hani Benhabiles <hani.benhabiles@greenbone.net>
Backport r24591.
* nasl/nasl_ssh.c (my_ssh_key_s, my_ssh_key, my_ssh_key_free)
(my_ssh_pki_import_privkey_base64, remove_and_free_temp_key_file)
(my_ssh_userauth_try_publickey, my_ssh_userauth_publickey): Define only
when using LibSSH version older than 0.6.
(nasl_ssh_userauth): Use functions from libssh 0.6 when available.
2016-02-26 Michael Wiegand <michael.wiegand@greenbone.net>
Post release version bump.
* CMakeLists.txt: Set version to 8.0.8.
2016-02-26 Michael Wiegand <michael.wiegand@greenbone.net>
Preparing the openvas-libraries 8.0.7 release.
......
......@@ -55,6 +55,12 @@ Recommended to have RADIUS support:
Install prerequisites on Debian GNU/Linux 'Wheezy' 7:
# apt-get install pkg-config libssh-dev libgnutls-dev libglib2.0-dev libpcap-dev \
libgpgme11-dev uuid-dev bison libksba-dev libhiredis-dev libsnmp-dev
libldap2-dev
Install prerequisites on Debian GNU/Linux 'Jessie' 8:
# apt-get install dpkg-dev pkg-config libssh-dev libgnutls28-dev libglib2.0-dev \
libpcap-dev libgpgme11-dev uuid-dev bison libksba-dev libhiredis-dev \
libsnmp-dev libgcrypt20-dev libldap2-dev
Compiling openvas-libraries
......
......@@ -45,6 +45,8 @@ typedef struct
///< UUID of user.
/*@null@ */ gchar *timezone;
///< Timezone of user. Set in OpenVAS Manager.
/*@null@ */ double default_severity;
///< Default Severity setting of user. Set in OpenVAS Manager.
/*@null@ */ gchar *severity_class;
///< Severity Class setting of user. Set in OpenVAS Manager.
/*@null@ */ int dynamic_severity;
......
......@@ -671,6 +671,10 @@ openvas_ssh_public_from_private (const char *private_key, const char *passphrase
return NULL;
ret = ssh_pki_export_pubkey_base64 (priv, &pub_key);
type = ssh_key_type_to_char (ssh_key_type (priv));
#if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 6, 4)
if (!strcmp (type, "ssh-ecdsa"))
type = ssh_pki_key_ecdsa_name (priv);
#endif
ssh_key_free (priv);
if (ret)
return NULL;
......
......@@ -94,6 +94,7 @@ bpf_open_live (char *iface, char *filter)
return -1;
}
pcaps[i] = ret;
pcap_freecode (&filter_prog);
return i;
}
......
......@@ -335,25 +335,27 @@ get_redis_ctx (struct kb_redis *kbr)
if (kbr->rctx != NULL)
return kbr->rctx;
kbr->rctx = redisConnectUnix (kbr->path);
if (kbr->rctx == NULL || kbr->rctx->err)
{
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"%s: redis connection error: %s", __func__,
kbr->rctx ? kbr->rctx->errstr : strerror (ENOMEM));
redisFree (kbr->rctx);
kbr->rctx = NULL;
return NULL;
}
do
{
kbr->rctx = redisConnectUnix (kbr->path);
if (kbr->rctx == NULL || kbr->rctx->err)
{
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"%s: redis connection error: %s", __func__,
kbr->rctx ? kbr->rctx->errstr : strerror (ENOMEM));
redisFree (kbr->rctx);
kbr->rctx = NULL;
return NULL;
}
rc = select_database (kbr);
if (rc)
{
g_debug ("%s: No redis DB available, retrying in %ds...", __func__,
KB_RETRY_DELAY);
sleep (KB_RETRY_DELAY);
redisFree (kbr->rctx);
kbr->rctx = NULL;
}
}
while (rc != 0);
......
......@@ -48,6 +48,7 @@
#include "kb.h" /* for kb_item_get_str() */
#include "ids_send.h"
#include "prefs.h"
#include "plugutils.h"
#include "internal_com.h" /* for INTERNAL_COMM_MSG_TYPE_CTRL */
#include "support.h"
......@@ -742,6 +743,10 @@ set_ids_evasion_mode (struct arglist *args, openvas_connection * fp)
sizeof (n));
fp->options |= option;
}
g_free (ids_evasion_split);
g_free (ids_evasion_inject);
g_free (ids_evasion_short_ttl);
g_free (ids_evasion_fake_rst);
}
/*
......@@ -1053,6 +1058,7 @@ open_stream_connection_ext (struct arglist *args, unsigned int port,
switch (transport)
{
int ret;
case OPENVAS_ENCAPS_IP:
break;
case OPENVAS_ENCAPS_SSLv23:
......@@ -1072,7 +1078,12 @@ open_stream_connection_ext (struct arglist *args, unsigned int port,
case OPENVAS_ENCAPS_SSLv2:
/* We do not need a client certificate in this case */
if (open_SSL_connection (fp, cert, key, passwd, cafile) <= 0)
ret = open_SSL_connection (fp, cert, key, passwd, cafile);
g_free (cert);
g_free (key);
g_free (passwd);
g_free (cafile);
if (ret <= 0)
goto failed;
break;
}
......@@ -1139,8 +1150,11 @@ struct ovas_scanner_context_s
/** GnuTLS priority string */
char *priority;
gnutls_session_t tls_session;
};
/**
* @brief Creates a new ovas_scanner_context_t.
*
......@@ -1157,7 +1171,7 @@ ovas_scanner_context_new (openvas_encaps_t encaps, const char *certfile,
{
ovas_scanner_context_t ctx = NULL;
ctx = g_malloc0 (sizeof (ovas_scanner_context_t));
ctx = g_malloc0 (sizeof (*ctx));
ctx->encaps = encaps;
ctx->priority = g_strdup (priority);
......@@ -1254,6 +1268,7 @@ ovas_scanner_context_attach (ovas_scanner_context_t ctx, int soc)
tlserror ("gnutls_init", ret);
goto fail;
}
ctx->tls_session = fp->tls_session;
my_gnutls_transport_set_lowat_default (fp->tls_session);
ret = set_gnutls_protocol (fp->tls_session, fp->transport, ctx->priority);
......@@ -2072,10 +2087,23 @@ open_sock_opt_hn (const char *hostname, unsigned int port, int type,
int
open_sock_tcp (struct arglist *args, unsigned int port, int timeout)
{
int ret;
int ret, retry = 0;
const char *timeout_retry;
timeout_retry = prefs_get ("timeout_retry");
if (timeout_retry)
retry = atoi (timeout_retry);
if (retry < 0)
retry = 0;
errno = 0;
ret = open_sock_option (args, port, SOCK_STREAM, IPPROTO_TCP, timeout);
while (retry >= 0)
{
errno = 0;
ret = open_sock_option (args, port, SOCK_STREAM, IPPROTO_TCP, timeout);
if (ret >= 0 || errno != ETIMEDOUT)
break;
retry--;
}
if (ret < 0 && errno == ETIMEDOUT)
{
int log_count;
......@@ -2215,6 +2243,8 @@ recv_line (int soc, char *buf, size_t bufsiz)
tv.tv_sec = 5;
tv.tv_usec = 0;
e = select (soc + 1, &rd, NULL, NULL, &tv);
if (e == 0 && !FD_ISSET (soc, &rd))
return -1;
if (e < 0 && errno == EINTR)
goto again;
if (e > 0)
......
......@@ -32,6 +32,7 @@
static int argv_len;
static char **old_argv;
extern char **environ;
void *current_environ = NULL;
/**
* @brief Initializes the process setting variables.
......@@ -50,6 +51,9 @@ proctitle_init (int argc, char **argv)
/* Move environ to new memory, to be able to reuse older one. */
while (envp[i]) i++;
environ = g_malloc0 (sizeof(char *) * (i + 1));
if (current_environ)
g_free (current_environ);
current_environ = environ;
for (i = 0; envp[i]; i++)
environ[i] = g_strdup (envp[i]);
environ[i] = NULL;
......
......@@ -336,7 +336,10 @@ openvas_server_open_with_cert (gnutls_session_t *session, const char *host,
{
/* Make server socket. */
server_socket = socket (PF_INET, SOCK_STREAM, 0);
if (address->ai_family == AF_INET6)
server_socket = socket (PF_INET6, SOCK_STREAM, 0);
else
server_socket = socket (PF_INET, SOCK_STREAM, 0);
if (server_socket == -1)
{
g_warning ("Failed to create server socket");
......
......@@ -318,14 +318,13 @@ static void
mark_post (const char *oid, struct arglist *desc, const char *action,
const char *content)
{
char entry_name[255], *ccontent;
char entry_name[255];
if (strlen (action) > (sizeof (entry_name) - 20))
return;
snprintf (entry_name, sizeof (entry_name), "SentData/%s/%s", oid, action);
ccontent = g_strdup (content);
plug_set_key (desc, entry_name, ARG_STRING, ccontent);
plug_set_key (desc, entry_name, ARG_STRING, content);
}
/**
......@@ -723,7 +722,7 @@ get_plugin_preference_file_size (struct arglist *desc, const char *identifier)
}
void
plug_set_key (struct arglist *args, char *name, int type, void *value)
plug_set_key (struct arglist *args, char *name, int type, const void *value)
{
kb_t kb = plug_get_kb (args);
......
......@@ -97,7 +97,7 @@ char * host_get_port_banner(struct arglist *, int);
/*
* Inter Plugins Communication functions
*/
void plug_set_key (struct arglist *, char *, int, void *);
void plug_set_key (struct arglist *, char *, int, const void *);
void plug_replace_key (struct arglist *, char *, int, void *);
kb_t plug_get_kb (struct arglist *);
void *plug_get_key (struct arglist *, char *, int *);
......
......@@ -167,7 +167,10 @@ cell2str (lex_ctxt * lexic, tree_cell * c)
if (c->x.str_val == NULL)
p = g_strdup ("");
else
p = g_memdup (c->x.str_val, c->size + 1);
{
p = g_malloc0 (c->size + 1);
memcpy (p, c->x.str_val, c->size);
}
return p;
case REF_ARRAY:
......
......@@ -1515,7 +1515,7 @@ may_be_time (time_t * rtime)
static int
plugin_do_run (struct arglist *desc, struct arglist *h, int test_ssl)
{
char *head = "Ports/tcp/";
char *head = "Ports/tcp/", *host_fqdn;
u_short unknown[65535];
int num_unknown = 0;
int len_head = strlen (head);
......@@ -1534,8 +1534,10 @@ plugin_do_run (struct arglist *desc, struct arglist *h, int test_ssl)
struct in_addr *p_ip = arg_get_value (hostinfos, "IP");
#endif
host_fqdn = plug_get_host_fqdn (desc);
http_get = g_strdup_printf ("GET / HTTP/1.0\r\nHost: %s\r\n\r\n",
plug_get_host_fqdn (desc));
host_fqdn);
g_free (host_fqdn);
if (rw_timeout_s != NULL && (x = atoi (rw_timeout_s)) > 0)
rw_timeout = x;
......@@ -2687,6 +2689,7 @@ plugin_run_find_service (lex_ctxt * lexic)
if (sons[i] < 0)
sons[i] = 0; /* Fork failed */
}
arg_free (sons_args[i]);
}
}
......
......@@ -43,6 +43,7 @@
#include <ksba.h>
#include <gcrypt.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "openvas_logging.h"
#include "nasl_tree.h"
......@@ -889,6 +890,28 @@ nasl_cert_query (lex_ctxt *lexic)
retc->size = strlen (name);
}
}
else if (!strcmp (command, "key-size"))
{
gnutls_datum_t datum;
gnutls_x509_crt_t cert = NULL;
unsigned int bits = 0;
datum.data = (void *) ksba_cert_get_image (obj->cert, (size_t *)
&datum.size);
if (!datum.data)
return NULL;
if (gnutls_x509_crt_init (&cert) != GNUTLS_E_SUCCESS)
return NULL;
if (gnutls_x509_crt_import (cert, &datum, GNUTLS_X509_FMT_DER)
!= GNUTLS_E_SUCCESS)
return NULL;
gnutls_x509_crt_get_pk_algorithm (cert, &bits);
gnutls_free (datum.data);
gnutls_x509_crt_deinit (cert);
retc = alloc_typed_cell (CONST_INT);
retc->x.i_val = bits;
}
else
{
log_legacy_write ("Unknown command '%s' passed to cert_query", command);
......
......@@ -215,6 +215,85 @@ nasl_get_sign (lex_ctxt * lexic)
return retc;
}
static void *
hmac_sha256 (void *key, int keylen, void *buf, int buflen)
{
void *signature = g_malloc0 (32);
gsize signlen = 32;
GHmac *hmac;
hmac = g_hmac_new (G_CHECKSUM_SHA256, key, keylen);
g_hmac_update (hmac, buf, buflen);
g_hmac_get_digest (hmac, signature, &signlen);
g_hmac_unref (hmac);
return signature;
}
tree_cell *
nasl_hmac_sha256 (lex_ctxt * lexic)
{
void *key, *buf, *signature;
int keylen, buflen;
tree_cell *retc;
key = get_str_var_by_name (lexic, "key");
buf = get_str_var_by_name (lexic, "buf");
keylen = get_int_var_by_name (lexic, "keylen", -1);
buflen = get_int_var_by_name (lexic, "buflen", -1);
if (!key || !buf || keylen <= 0 || buflen <= 0)
{
nasl_perror (lexic,
"Syntax : hmac_sha256(buf:<b>, buflen:<bl>, key:<k>, keylen:<kl>)\n");
return NULL;
}
signature = hmac_sha256 (key, keylen, buf, buflen);
retc = alloc_tree_cell (0, NULL);
retc->type = CONST_DATA;
retc->size = 32;
retc->x.str_val = (char *) signature;
return retc;
}
tree_cell *
nasl_get_smb2_sign (lex_ctxt * lexic)
{
void *key, *buf, *signature, *ret;
int keylen, buflen;
tree_cell *retc;
key = get_str_var_by_name (lexic, "key");
buf = get_str_var_by_name (lexic, "buf");
keylen = get_var_size_by_name (lexic, "key");
buflen = get_var_size_by_name (lexic, "buf");
if (!key || !buf || keylen <= 0)
{
nasl_perror (lexic,
"Syntax : get_smb2_sign(buf:<b>, key:<k>)");
return NULL;
}
if (buflen < 64)
{
nasl_perror (lexic, "get_smb2_sign: Buffer length < 64");
return NULL;
}
/* Zero the SMB2 signature field, then calculate signature */
memset(buf + 48, 0, 16);
signature = hmac_sha256 (key, keylen, buf, buflen);
/* Return the header with signature included. */
ret = g_malloc0 (buflen);
memcpy (ret, buf, buflen);
memcpy (ret + 48, signature, 16);
g_free (signature);
retc = alloc_tree_cell (0, NULL);
retc->type = CONST_DATA;
retc->size = buflen;
retc->x.str_val = (char *) ret;
return retc;
}
tree_cell *
nasl_ntlmv2_response (lex_ctxt * lexic)
{
......
......@@ -46,4 +46,6 @@ tree_cell *nasl_keyexchg (lex_ctxt * lexic);
tree_cell *nasl_insert_hexzeros (lex_ctxt * lexic);
tree_cell *nasl_get_password (lex_ctxt * lexic);
tree_cell *nasl_get_sign (lex_ctxt * lexic);
tree_cell *nasl_get_smb2_sign (lex_ctxt * lexic);
tree_cell *nasl_hmac_sha256 (lex_ctxt * lexic);
#endif
......@@ -860,8 +860,10 @@ mylex(lvalp, parm)
default:
nasl_perror(NULL, "Unknown escape sequence \\%c\n", c);
*p++ = c; len ++;
break;
ungetc(c, fp);
if (c == '\n')
ctx->line_nb --;
goto exit_loop;
}
}
else
......
......@@ -127,13 +127,16 @@ _http_req (lex_ctxt * lexic, char *keyword)
ua = kb_item_get_str (kb, "http/user-agent");
#define OPENVAS_USER_AGENT "Mozilla/5.0 [en] (X11, U; OpenVAS)"
if (ua == NULL)
ua = OPENVAS_USER_AGENT;
ua = g_strdup (OPENVAS_USER_AGENT);
else
{
while (isspace (*ua))
ua++;
if (*ua == '\0')
ua = OPENVAS_USER_AGENT;
{
g_free (ua);
ua = g_strdup (OPENVAS_USER_AGENT);
}
}
/* Servers should not have a problem with port 80 or 443 appended.
......@@ -164,6 +167,7 @@ Accept-Language: en\r\n\
Accept-Charset: iso-8859-1,*,utf-8\r\n", url, hostheader, ua);
g_free (hostname);
g_free (hostheader);
g_free (ua);
}
else
{
......
......@@ -371,6 +371,10 @@ static init_func libfuncs[] = {
{"dec2str", nasl_dec2str, 0, {"num", NULL}},
{"get_signature", nasl_get_sign, 0,
{"buf", "buflen", "key", "seq_number", NULL}},
{"get_smb2_signature", nasl_get_smb2_sign, 0,
{"buf", "key", NULL}},
{"hmac_sha256", nasl_hmac_sha256, 0,
{"buf", "buflen", "key", "keylen", NULL}},
{"dh_generate_key", nasl_dh_generate_key, 0, {"g", "p", "priv", NULL}},
{"bn_random", nasl_bn_random, 0, {"need", NULL}},
{"bn_cmp", nasl_bn_cmp, 0, {"key1", "key2", NULL}},
......
......@@ -600,8 +600,7 @@ nasl_typeof (lex_ctxt * lexic)
break;
}
retc->size = strlen (s);
retc->x.str_val = g_malloc0 (retc->size);
strcpy (retc->x.str_val, s); /* Flawfinder: ignore */
retc->x.str_val = g_strdup (s);
return retc;
}
......
......@@ -114,6 +114,7 @@ snmpv3_get (const char *peername, const char *username, const char *authpass,
assert (oid_str);
assert (result);
setenv ("MIBS", "", 1);
init_snmp ("openvas");
snmp_sess_init (&session);
session.version = SNMP_VERSION_3;
......@@ -193,6 +194,7 @@ snmpv1v2c_get (const char *peername, const char *community, const char *oid_str,
assert (oid_str);
assert (version == SNMP_VERSION_1 || version == SNMP_VERSION_2c);
setenv ("MIBS", "", 1);
snmp_sess_init (&session);
session.version = version;
session.peername = (char *) peername;
......
......@@ -756,7 +756,7 @@ nasl_recv (lex_ctxt * lexic)
{
tree_cell *retc = alloc_tree_cell (0, NULL);
retc->type = CONST_DATA;
retc->x.str_val = g_memdup (data, new_len + 1);
retc->x.str_val = g_memdup (data, new_len);
retc->size = new_len;
g_free (data);
return retc;
......
......@@ -137,6 +137,7 @@ g_string_comma_str (GString *gstr, const char *str)
easier. The idea is that you only need to remove these wrappers
and s/my_ssh_/ssh_/ on this file. */
#if LIBSSH_VERSION_INT < SSH_VERSION_INT (0, 6, 0)
struct my_ssh_key_s
{