Browse Source

Fix two Clang static analyzer issues

Overflowing memory allocations should crash or exit anyway.
tags/v0.9
Přemysl Janouch 5 years ago
parent
commit
a87be6dfd2
2 changed files with 3 additions and 1 deletions
  1. +2
    -0
      src/common.c
  2. +1
    -1
      src/zyklonb.c

+ 2
- 0
src/common.c View File

@@ -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

+ 1
- 1
src/zyklonb.c View File

@@ -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;

Loading…
Cancel
Save