diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/conntrack.c | 5 |
2 files changed, 8 insertions, 0 deletions
@@ -53,6 +53,9 @@ o remove "-g" from Makefile.am, this should be specified by the user o enable C99 mode o use C99 integers (uint32_t instead of u_int32_t) += conntrack = +o check for malloc() failure in merge_opts + = conntrackd = o resolve global variable "alarm" conflict with alarm() function in unistd.h. o enable gcc warnings, including -Werror diff --git a/src/conntrack.c b/src/conntrack.c index b8843d4..7918b3f 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -271,6 +271,9 @@ merge_options(struct option *oldopts, const struct option *newopts, *option_offset = global_option_offset; merge = malloc(sizeof(struct option) * (num_new + num_old + 1)); + if (merge == NULL) + return NULL; + memcpy(merge, oldopts, num_old * sizeof(struct option)); for (i = 0; i < num_new; i++) { merge[num_old + i] = newopts[i]; @@ -838,6 +841,8 @@ int main(int argc, char *argv[]) ATTR_ORIG_L4PROTO, h->protonum); opts = merge_options(opts, h->opts, &h->option_offset); + if (opts == NULL) + exit_error(EXIT_FAILURE, "out of memory\n"); break; case 't': options |= CT_OPT_TIMEOUT; |