summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-07-19 22:35:12 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-07-19 22:35:12 +0200
commita87be6dfd2194326487a6e6152c1a3086f3ae15a (patch)
treeb650f421231226015e6e84c4734b4aa3cde64a82 /src
parent027333e56aeea20c486702ecfb9571ca45fd14f6 (diff)
downloadxK-a87be6dfd2194326487a6e6152c1a3086f3ae15a.tar.gz
xK-a87be6dfd2194326487a6e6152c1a3086f3ae15a.tar.xz
xK-a87be6dfd2194326487a6e6152c1a3086f3ae15a.zip
Fix two Clang static analyzer issues
Overflowing memory allocations should crash or exit anyway.
Diffstat (limited to 'src')
-rw-r--r--src/common.c2
-rw-r--r--src/zyklonb.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c
index b3d5e1b..fba82b4 100644
--- a/src/common.c
+++ b/src/common.c
@@ -1072,6 +1072,8 @@ poller_ensure_space (struct poller *self)
return;
self->alloc <<= 1;
+ hard_assert (self->alloc != 0);
+
self->revents = xreallocarray
(self->revents, sizeof *self->revents, self->alloc);
self->info = xreallocarray
diff --git a/src/zyklonb.c b/src/zyklonb.c
index ca579d1..1d2388f 100644
--- a/src/zyklonb.c
+++ b/src/zyklonb.c
@@ -773,7 +773,7 @@ plugin_process_message (const struct irc_message *msg,
return;
const char *command = msg->params.vector[0];
- if (!strcasecmp (command, "register"))
+ if (!plugin->initialized && !strcasecmp (command, "register"))
{
// Register for relaying of IRC traffic
plugin->initialized = true;