From 6068d3b2c9d0ee2942900b88db81c0edb0411ef0 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 26 May 2017 03:35:59 +0000 Subject: [PATCH] bsdgrep: use safer sizeof() construct Submitted by: Kyle Evans --- usr.bin/grep/regex/tre-fastmatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c index bf59b9f8d551..6bf7c446529e 100644 --- a/usr.bin/grep/regex/tre-fastmatch.c +++ b/usr.bin/grep/regex/tre-fastmatch.c @@ -351,7 +351,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data, #define FILL_BMGS \ if (fg->len > 0 && !fg->hasdot) \ { \ - fg->sbmGs = malloc(fg->len * sizeof(int)); \ + fg->sbmGs = malloc(fg->len * sizeof(*fg->sbmGs)); \ if (!fg->sbmGs) \ return REG_ESPACE; \ if (fg->len == 1) \ @@ -367,7 +367,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data, #define FILL_BMGS_WIDE \ if (fg->wlen > 0 && !fg->hasdot) \ { \ - fg->bmGs = malloc(fg->wlen * sizeof(int)); \ + fg->bmGs = malloc(fg->wlen * sizeof(*fg->bmGs)); \ if (!fg->bmGs) \ return REG_ESPACE; \ if (fg->wlen == 1) \