summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7428c30)
raw | patch | inline | side by side (parent: 7428c30)
author | Sebastian Harl <sh@tokkee.org> | |
Thu, 26 Dec 2013 12:49:55 +0000 (13:49 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Thu, 26 Dec 2013 12:49:55 +0000 (13:49 +0100) |
The following issues were identified and fixed:
* Allocator sizeof operand mismatch in dbi utils.
* Dead increment in tools/sysdb/input.
* Memory leak (and leaving behind invalid memory) in tools/sysdbd/configfile.
* Out-of-bound array access in core/plugin (the original report by the clang
analyzer was wrong but pointed to a location affected by a related
problem).
* Stack address stored into global variable in liboconfig.
Thanks to cppcheck and the clang analyzer!
* Allocator sizeof operand mismatch in dbi utils.
* Dead increment in tools/sysdb/input.
* Memory leak (and leaving behind invalid memory) in tools/sysdbd/configfile.
* Out-of-bound array access in core/plugin (the original report by the clang
analyzer was wrong but pointed to a location affected by a related
problem).
* Stack address stored into global variable in liboconfig.
Thanks to cppcheck and the clang analyzer!
diff --git a/src/core/plugin.c b/src/core/plugin.c
index 46976d01f7435c580e088f3aebd7836ad14ebbf4..a3aba99ed40b70b05cb91be314c7ac434eeb58a6 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
int
sdb_plugin_load(const char *name, const sdb_plugin_ctx_t *plugin_ctx)
{
- char real_name[strlen(name) > 0 ? strlen(name) : 1];
+ char real_name[name ? strlen(name) + 1 : 1];
const char *name_ptr;
char *tmp;
index 629775ab8c44dd55de5d930d0189168546d455c3..427f957cb047e72e6cf92e5875ceadec5f2d369f 100644 (file)
--- a/src/liboconfig/oconfig.c
+++ b/src/liboconfig/oconfig.c
if (status != 0)
{
fprintf (stderr, "yyparse returned error #%i\n", status);
+ c_file = NULL;
return (NULL);
}
index 3366fd9397bd7998a7c4b7f4d70c9493cefd8e3d..0513ee0586ad6dc6fcc3dbfa0b39cf0a13297fc9 100644 (file)
--- a/src/tools/sysdb/input.c
+++ b/src/tools/sysdb/input.c
int *n_chars, size_t max_chars)
{
const char *query;
- size_t buflen, len;
+ size_t len;
- buflen = sdb_strbuf_len(input->buf);
- len = buflen - input->tokenizer_pos;
+ len = sdb_strbuf_len(input->buf) - input->tokenizer_pos;
if (! len) {
size_t n = input_readline(input->buf);
*n_chars = 0; /* YY_NULL */
return 0;
}
- buflen += n;
len += n;
}
index 95276264ae104174c2fde573560cc0bf700253cb..9c7308d1bc2d0c1bd8efd172f128922c2193db61 100644 (file)
return -1;
}
- tmp[listen_addresses_num] = strdup(address);
- if (! tmp[listen_addresses_num]) {
+ listen_addresses = tmp;
+ listen_addresses[listen_addresses_num] = strdup(address);
+ if (! listen_addresses[listen_addresses_num]) {
char buf[1024];
sdb_log(SDB_LOG_ERR, "config: Failed to allocate memory: %s",
sdb_strerror(errno, buf, sizeof(buf)));
return -1;
}
- listen_addresses = tmp;
++listen_addresses_num;
return 0;
} /* daemon_add_listener */
diff --git a/src/utils/dbi.c b/src/utils/dbi.c
index d9bd3691391ad80a0728a2f9ac88c03033627fa4..1de2f1abe678b74dae092b4b51b40a888b68ceb0 100644 (file)
--- a/src/utils/dbi.c
+++ b/src/utils/dbi.c
{
sdb_dbi_options_t *options;
- options = malloc(sizeof(options));
+ options = malloc(sizeof(*options));
if (! options)
return NULL;