On Mon, Jul 09, 2012 at 07:28:12AM -0400, Stephen Gallagher wrote:
On Sun, 2012-07-08 at 22:02 +0200, Jakub Hrozek wrote:
> I was not able to log in today, I was getting krb5_child segfaults. The
> attached patch fixed that.
Nack.
I fail to see how this could possibly have caused a segfault. The
previous version would have been printing either "true" or "false"
based
on whether the pointer was NULL or contained a value. This was
incorrect, but should be impossible to segfault on.
Yeah, the segfault was caused by incorrect format string. I'll send a
separate patch for that issue.
I assumed this was the reason because I no longer saw the segfault on my
laptop, but it turned out that the crash went away only because I tested
a build compiled with -O0, krb5_child was still crashing when compiled
with -O2.
However, the new patch changes this to a dereference without checking
the validity of the offline pointer first. So now you've introduced the
possibility of a segfault if the pointer is uninitialized (though it
never should be).
We write into the address earlier anyway, so we depended on the pointer
validity. I've added a check, though.