From 92fe2d5c9fdc6d3024e773f405e70ef428c28b81 Mon Sep 17 00:00:00 2001 From: vsc Date: Wed, 15 May 2002 03:41:19 +0000 Subject: [PATCH] check overflow while copying constraints. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@471 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/dbase.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C/dbase.c b/C/dbase.c index 4d9bc7b40..1521dfacf 100644 --- a/C/dbase.c +++ b/C/dbase.c @@ -879,7 +879,10 @@ static CELL *MkDBTerm(register CELL *pt0, register CELL *pt0_end, *ConstraintsBottom = new; ConstraintsBottom = RepAppl(new)+4; } - memcpy((void *)(H), (void *)(to_visit_base), sz*sizeof(CELL *)); + if (H+sz >= ASP) { + goto error2; + } + memcpy((void *)H, (void *)(to_visit_base), sz*sizeof(CELL *)); to_visit_base = (CELL **)H; to_visit = to_visit_base+sz; }