From: millert Date: Wed, 8 Jan 2014 23:12:57 +0000 (+0000) Subject: We still need to cast the resulting pointer in NEW and NEW2 as it X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fc2da2167d43a177115db568ab0a094e4c1cd71a;p=openbsd We still need to cast the resulting pointer in NEW and NEW2 as it is used in pointer arithmetic. Otherwise we do arithmetic on void * and corrupt the heap. --- diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h index 1aa9f3d8e02..1817db7d075 100644 --- a/usr.bin/yacc/defs.h +++ b/usr.bin/yacc/defs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: defs.h,v 1.14 2014/01/08 22:30:32 millert Exp $ */ +/* $OpenBSD: defs.h,v 1.15 2014/01/08 23:12:57 millert Exp $ */ /* $NetBSD: defs.h,v 1.6 1996/03/19 03:21:30 jtc Exp $ */ /* @@ -137,8 +137,8 @@ /* storage allocation macros */ -#define NEW(t) (allocate(sizeof(t))) -#define NEW2(n,t) (allocate((n)*sizeof(t))) +#define NEW(t) ((t*)allocate(sizeof(t))) +#define NEW2(n,t) ((t*)allocate((n)*sizeof(t))) /* the structure of a symbol table entry */