diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-17 17:20:25 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2008-01-17 17:20:25 +0000 |
commit | a5cf250034b1f4c3fbd0b2081a756db9b20d9c7e (patch) | |
tree | 1b40810350a8601bfe4de280c43197d512ccf36f /src | |
parent | 5c7db5abef470bc6a0f2e3858a5fc75731c9f3bd (diff) | |
download | conntrack-tools-a5cf250034b1f4c3fbd0b2081a756db9b20d9c7e.tar.gz conntrack-tools-a5cf250034b1f4c3fbd0b2081a756db9b20d9c7e.zip |
Max Kellermann <max@duempel.org>:
check for malloc() failure in merge_opts
Diffstat (limited to 'src')
-rw-r--r-- | src/conntrack.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; |