Fix use of uninitalized memory. Found by malloc option J. okay naddy@

This commit is contained in:
kurt 2009-11-17 01:04:43 +00:00
parent 4463d5b0ed
commit 48dd291538
2 changed files with 16 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.3 2009/04/01 17:17:37 jasper Exp $
# $OpenBSD: Makefile,v 1.4 2009/11/17 01:04:43 kurt Exp $
ONLY_FOR_ARCHS = amd64 i386 powerpc sparc sparc64
COMMENT = ANS Standard Forth interpreter and compiler
DISTNAME = gforth-0.6.2
PKGNAME = ${DISTNAME}p0
PKGNAME = ${DISTNAME}p1
CATEGORIES = lang
HOMEPAGE = http://www.jwdt.com/~paysan/gforth.html

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-engine_engine_c,v 1.1 2009/11/17 01:04:43 kurt Exp $
--- engine/engine.c.orig Fri Nov 13 17:29:14 2009
+++ engine/engine.c Fri Nov 13 17:29:33 2009
@@ -304,8 +304,8 @@ Label *engine(Xt *ip0, Cell *sp0, Cell *rp0, Float *fp
Cell code_offset = offset_image? CODE_OFFSET : 0;
Cell xt_offset = offset_image? XT_OFFSET : 0;
- symbols = (Label *)(malloc(MAX_SYMBOLS*sizeof(Cell)+CODE_OFFSET)+code_offset);
- xts = (Label *)(malloc(MAX_SYMBOLS*sizeof(Cell)+XT_OFFSET)+xt_offset);
+ symbols = (Label *)(calloc(1, MAX_SYMBOLS*sizeof(Cell)+CODE_OFFSET)+code_offset);
+ xts = (Label *)(calloc(1, MAX_SYMBOLS*sizeof(Cell)+XT_OFFSET)+xt_offset);
for (i=0; i<DOESJUMP+1; i++)
xts[i] = symbols[i] = (Label)routines[i];
for (; routines[i]!=0; i++) {