Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 May 2017 03:35:59 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r318916 - head/usr.bin/grep/regex
Message-ID:  <201705260335.v4Q3ZxAL082425@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Fri May 26 03:35:59 2017
New Revision: 318916
URL: https://svnweb.freebsd.org/changeset/base/318916

Log:
  bsdgrep: use safer sizeof() construct
  
  Submitted by:	Kyle Evans <kevans91@ksu.edu>

Modified:
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/regex/tre-fastmatch.c
==============================================================================
--- head/usr.bin/grep/regex/tre-fastmatch.c	Fri May 26 03:27:06 2017	(r318915)
+++ head/usr.bin/grep/regex/tre-fastmatch.c	Fri May 26 03:35:59 2017	(r318916)
@@ -351,7 +351,7 @@ static int	fastcmp(const fastmatch_t *fg
 #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
 #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)						\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705260335.v4Q3ZxAL082425>