diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pcc/ccom/cgram.y | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/pcc/ccom/cgram.y b/usr.bin/pcc/ccom/cgram.y index 7cec014fb61..b914b1c4612 100644 --- a/usr.bin/pcc/ccom/cgram.y +++ b/usr.bin/pcc/ccom/cgram.y @@ -1,4 +1,4 @@ -/* $OpenBSD: cgram.y,v 1.6 2007/11/22 15:06:43 stefan Exp $ */ +/* $OpenBSD: cgram.y,v 1.7 2007/11/25 10:27:35 stefan Exp $ */ /* * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se). @@ -562,6 +562,10 @@ struct_declarator: declarator { | ':' con_e { if (!(instruct&INSTRUCT)) uerror( "field outside of structure" ); + if ($2 < 0 || $2 >= FIELD) { + uerror("illegal field size"); + $2 = 1; + } falloc(NULL, $2, -1, $<nodep>0); } | declarator ':' con_e { |