From ea5e026a0d10c52e1e5e9fb2dc446fed21552919 Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Sun, 16 Apr 2017 01:15:37 +0000 Subject: [PATCH] Fix CID 1372600, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372600 MFC after: 1 week --- contrib/ipfilter/tools/ipf_y.y | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/ipfilter/tools/ipf_y.y b/contrib/ipfilter/tools/ipf_y.y index 7feb83e15b8f..fc4884434347 100644 --- a/contrib/ipfilter/tools/ipf_y.y +++ b/contrib/ipfilter/tools/ipf_y.y @@ -2195,6 +2195,10 @@ char *phrase; for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL; s = strtok(NULL, " \r\n\t"), i++) { fb = reallocarray(fb, i / 4 + 1, sizeof(*fb)); + if (fb == NULL) { + perror("memory allocation error at __LINE__ in __FUNCTION__ in __FILE"); + abort(); + } l = (u_32_t)strtol(s, NULL, 0); switch (i & 3) {