diff options
author | 2014-01-08 23:12:57 +0000 | |
---|---|---|
committer | 2014-01-08 23:12:57 +0000 | |
commit | fc2da2167d43a177115db568ab0a094e4c1cd71a (patch) | |
tree | b935b4c8f14e39b37b3e0adef5fa72cf1f39c858 | |
parent | Add casts to unsigned char for ctype functions and other places (diff) | |
download | wireguard-openbsd-fc2da2167d43a177115db568ab0a094e4c1cd71a.tar.xz wireguard-openbsd-fc2da2167d43a177115db568ab0a094e4c1cd71a.zip |
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.
-rw-r--r-- | usr.bin/yacc/defs.h | 6 |
1 files changed, 3 insertions, 3 deletions
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 */ |