Taylor R Campbell 0f998cdbc2 ktutil: Avoid even doing arithmetic on res after realloc(res, ...).
Under C99, Sec 6.2.4, paragraph 2:

    The value of a pointer becomes indeterminate when the object it
    points to reaches the end of its lifetime.

`Indeterminate' (3.17.2) includes a trap representation, and any
reference to a trap representation is undefined behaviour.  Thus,
after realloc(res, ...) succeeds, any reference to res (or p) is
undefined behaviour.

So, instead of using `p - res` after res has been freed, use the
existing name for the value we know it has now: len.  (We could also
use alloced because p == end in this branch, and end = res + alloced,
and p = res + len.  Of course, we would have to move it up a line to
before we update alloced to have a different value.)

fix https://github.com/heimdal/heimdal/issues/1164
2023-11-07 14:20:40 -06:00
..
2022-01-14 17:59:49 -06:00
2008-09-13 08:53:55 +00:00
2009-01-25 20:48:54 +00:00
2009-01-30 16:48:36 +00:00
2023-05-26 13:23:47 -05:00
2011-05-21 11:57:31 -07:00
2022-10-03 09:44:22 -05:00
2009-02-27 03:33:35 +00:00
2008-09-13 09:21:03 +00:00
2008-09-13 09:21:03 +00:00