Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Veksler <Mihails.Vekslers@zabbix.com>2018-04-26 17:25:20 +0300
committerMichael Veksler <Mihails.Vekslers@zabbix.com>2018-04-26 17:25:20 +0300
commitd265c1ee5995d72c86a0211cd63e061e0f9373dd (patch)
treea58340d84884d5fdb9655613e5121a2b1311561e
parent677019489a39de7fc0204a0ddc541f81cdccc9c4 (diff)
...G...... [ZBX-13781] fixed an uninitialised error string
-rw-r--r--ChangeLog2
-rw-r--r--src/libs/zbxsysinfo/common/http.c5
-rw-r--r--tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c17
3 files changed, 22 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 10ce6c3720d..3479248dfcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -273,6 +273,7 @@ Bug fixes:
Changes for 3.4.9rc2
Bug fixes:
+...G...... [ZBX-13781] fixed possible crash due to uninitialised error string in Zabbix Agentd (MVekslers)
--------------------------------------------------------------------------------
Changes for 3.4.9rc1
@@ -1477,6 +1478,7 @@ A......... [ZBX-10049] fixed optional field validation in drule.update API metho
Changes for 3.0.17rc2
Bug fixes:
+...G...... [ZBX-13781] fixed possible crash due to uninitialised error string in Zabbix Agentd (MVekslers)
--------------------------------------------------------------------------------
Changes for 3.0.17rc1
diff --git a/src/libs/zbxsysinfo/common/http.c b/src/libs/zbxsysinfo/common/http.c
index 237c5fa09c9..7d4333d96b1 100644
--- a/src/libs/zbxsysinfo/common/http.c
+++ b/src/libs/zbxsysinfo/common/http.c
@@ -29,7 +29,7 @@
#define ZBX_MAX_WEBPAGE_SIZE (1 * 1024 * 1024)
static const char URI_PROHIBIT_CHARS[] = {0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0xA,0xB,0xC,0xD,0xE,0xF,0x10,0x11,0x12,\
- 0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x7F};
+ 0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x7F,0};
static int get_http_page(const char *host, const char *path, unsigned short port, char *buffer,
size_t max_buffer_len, char **error)
@@ -77,7 +77,8 @@ static int get_http_page(const char *host, const char *path, unsigned short port
if (FAIL == ret)
{
- zabbix_log(LOG_LEVEL_DEBUG, "HTTP get error: %s", zbx_socket_strerror());
+ *error = zbx_dsprintf(NULL, "HTTP get error: %s", zbx_socket_strerror());
+ zabbix_log(LOG_LEVEL_DEBUG, "%s", *error);
return SYSINFO_RET_FAIL;
}
diff --git a/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c b/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c
index 19954005b76..313e021fa27 100644
--- a/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c
+++ b/tests/libs/zbxsysinfo/common/WEB_PAGE_GET.c
@@ -76,11 +76,24 @@ void zbx_mock_test_entry(void **state)
int __wrap_zbx_tcp_connect(zbx_socket_t *s, const char *source_ip, const char *ip, unsigned short port,
int timeout, unsigned int tls_connect, const char *tls_arg1, const char *tls_arg2)
{
+ ZBX_UNUSED(s);
+ ZBX_UNUSED(source_ip);
+ ZBX_UNUSED(ip);
+ ZBX_UNUSED(port);
+ ZBX_UNUSED(timeout);
+ ZBX_UNUSED(tls_connect);
+ ZBX_UNUSED(tls_arg1);
+ ZBX_UNUSED(tls_arg2);
+
return SUCCEED;
}
int __wrap_zbx_tcp_send_ext(zbx_socket_t *s, const char *data, size_t len, unsigned char flags, int timeout)
{
+ ZBX_UNUSED(s);
+ ZBX_UNUSED(flags);
+ ZBX_UNUSED(timeout);
+
http_req = data;
http_len = len;
return SUCCEED;
@@ -88,6 +101,9 @@ int __wrap_zbx_tcp_send_ext(zbx_socket_t *s, const char *data, size_t len, unsig
ssize_t __wrap_zbx_tcp_recv_raw_ext(zbx_socket_t *s, int timeout)
{
+ ZBX_UNUSED(s);
+ ZBX_UNUSED(timeout);
+
s->buffer = (char *)http_req;
s->buffer[http_len++] = '*'; /* workaround for zbx_rtrim */
s->buffer[http_len++] = '\0';
@@ -96,4 +112,5 @@ ssize_t __wrap_zbx_tcp_recv_raw_ext(zbx_socket_t *s, int timeout)
void __wrap_zbx_tcp_close(zbx_socket_t *s)
{
+ ZBX_UNUSED(s);
}