fix the cookie checks

This commit is contained in:
tg 2008-11-12 07:02:47 +00:00
parent 518d37b6bf
commit 079e86501a
1 changed files with 3 additions and 11 deletions

View File

@ -1,6 +1,6 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/aalloc.c,v 1.21 2008/11/12 06:58:49 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/aalloc.c,v 1.22 2008/11/12 07:02:47 tg Exp $");
/* mksh integration of aalloc */ /* mksh integration of aalloc */
@ -262,11 +262,7 @@ track_check(void)
ap = track; ap = track;
ap->ocookie ^= gcookie; ap->ocookie ^= gcookie;
ap->prev.iv ^= gcookie; ap->prev.iv ^= gcookie;
if ((ap->prev.iv & PVMASK) if ((ap->prev.iv & PVMASK) || (ap->ocookie & PVMASK)) {
#ifndef AALLOC_NO_COOKIES
|| !(ap->ocookie & PVMASK)
#endif
) {
/* buffer overflow or something? */ /* buffer overflow or something? */
AALLOC_WARN("AALLOC_TRACK data structure %p destroyed:" AALLOC_WARN("AALLOC_TRACK data structure %p destroyed:"
" %p, %p, %p; exiting", ap, ap->prev.pv, " %p, %p, %p; exiting", ap, ap->prev.pv,
@ -336,11 +332,7 @@ adelete(PArea *pap)
while (tp) { while (tp) {
TPtr lp; TPtr lp;
lp.iv = tp->prev.iv ^ gcookie; lp.iv = tp->prev.iv ^ gcookie;
if ((lp.iv & PVMASK) if ((lp.iv & PVMASK) || (tp->ocookie & PVMASK)) {
#ifndef AALLOC_NO_COOKIES
|| !(tp->ocookie & PVMASK)
#endif
) {
AALLOC_WARN("AALLOC_TRACK data structure %p destroyed:" AALLOC_WARN("AALLOC_TRACK data structure %p destroyed:"
" %p, %p, %p", tp, tp->prev.pv, tp->bp.pv, " %p, %p, %p", tp, tp->prev.pv, tp->bp.pv,
(void *)tp->ocookie); (void *)tp->ocookie);