[PATCH] Avoiding Dereferencing of NULL pointer

Gert Doering gert at greenie.muc.de
Mon Oct 7 06:14:34 AEDT 2019


On Sun, Oct 06, 2019 at 08:38:23PM +0200, Alex Bligh wrote:
> The initialization to NULL sounds bogus but technically gmtime can return
> NULL at least on some systems. From the manpage on OS-X (closest I had
> to hand):

While the return value can be NULL (so the *check* for NULL is a bit
obscure but theoretically "it could happen"), the *initialization* is
just bogus - this is not a pass-by-reference pointer that could be set
or not, but a function return value, which is always set (possibly
to NULL), and always overwrites whatever you init it with.

"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             gert at greenie.muc.de

More information about the openssh-unix-dev mailing list