gethostname() with no check for zero-len
Brought to you by:
jcalcote
I am porting OpenSLP to VxWorks and found that the
slpd daemon will crash if the host name for the platform
was not set.
Under VxWorks the platform host name can be NULL,
and a call to gethostname() will return a status of OK in
that case but the strlen() of the resultant host name will
be zero. The slpd code checks the status of the
gethostname() call, but does not also check the length
to make sure it's not zero. Later on when this null-string
is referenced, the slpd daemon will terminate.
Logged In: NO
Glenn Highland
Sr. Software Engineer
CNT
glenn_highland@cnt.com