From a6bc4f125a59f46f16a19a9e042825cae3dbc24c Mon Sep 17 00:00:00 2001 From: emaste 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) \