diff options
author | cy <cy@FreeBSD.org> | 2017-04-23 03:16:38 +0000 |
---|---|---|
committer | cy <cy@FreeBSD.org> | 2017-04-23 03:16:38 +0000 |
commit | c7a6e462c3bd68f7d5abd3526f03c80694ab0523 (patch) | |
tree | e5d80138dbc5cec9eecf4940cd6d3105d5fde315 /contrib/ipfilter/tools | |
parent | 0541fbfd4945a1e55d54c1329cc9f19c3ed9072f (diff) | |
download | FreeBSD-src-c7a6e462c3bd68f7d5abd3526f03c80694ab0523.zip FreeBSD-src-c7a6e462c3bd68f7d5abd3526f03c80694ab0523.tar.gz |
MFC r316993, r316994, r316997 as follows:
r316993:
Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer
dereference should reallocarray() fail.
Reported by: Coverity CID 1372601
r316994:
Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer
dereference should reallocarray() fail.
Reported by: Coverity CID 1372600
r316997:
Use warnx() to issue error message.
Reported by: cem
Diffstat (limited to 'contrib/ipfilter/tools')
-rw-r--r-- | contrib/ipfilter/tools/ipf_y.y | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/ipfilter/tools/ipf_y.y b/contrib/ipfilter/tools/ipf_y.y index e0dc847..2ff9abd 100644 --- a/contrib/ipfilter/tools/ipf_y.y +++ b/contrib/ipfilter/tools/ipf_y.y @@ -9,6 +9,7 @@ #include "ipf.h" #include <sys/ioctl.h> #include <syslog.h> +#include <err.h> #ifdef IPFILTER_BPF # include <pcap.h> #endif @@ -2195,6 +2196,10 @@ char *phrase; for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL; s = strtok(NULL, " \r\n\t"), i++) { fb = realloc(fb, (i / 4 + 1) * sizeof(*fb)); + if (fb == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } l = (u_32_t)strtol(s, NULL, 0); switch (i & 3) { |