Fix bugs with memory allocation in ego.
authorGeorge Koehler <xkernigh@netscape.net>
Sat, 10 Sep 2016 03:37:43 +0000 (23:37 -0400)
committerGeorge Koehler <xkernigh@netscape.net>
Sat, 10 Sep 2016 03:37:43 +0000 (23:37 -0400)
commitb1d1b5e1f8fbcb2e7016c8a4d2e7fc45975504e3
treeb73c7b78385a36937fc85f6d1a4bea5f0ad0ca39
parent8c94b1316c14e5ad98d8518e2f9c6f25d1566f5f
Fix bugs with memory allocation in ego.

cf/cf_loop.c and share/put.c tried to read the next pointer in an
element of a linked list after freeing the element.  ud/ud_copy.c
tried to read beyond the end of the _defs_ array: it only has
_nrexpldefs_ elements, not _nrdefs_ elements.

These bugs caused core dumps on OpenBSD.  Its malloc() put _defs_ near
the end of a page, so reading beyond the end crossed into an unmapped
page.  Its free() wrote junk bytes and changed the next pointer to
0xdfdfdfdfdfdfdfdf.
util/ego/cf/cf_loop.c
util/ego/share/put.c
util/ego/ud/ud_copy.c