[omniORB] 2.8.0 uninitialized mem dec/osf1

Peter Bauer PBHD@compuserve.com
Wed, 13 Oct 1999 13:30:18 -0400


Hello,

when playing with third (something like purify on dec osf), I found
uninitialized memory
in libcwrapper.cc:
  // Use gethostbyname_r() on Digital UNIX
  if (!h.pd_buffer) {
    h.pd_buffer =3D new char[sizeof(struct hostent_data)];
    // XXX Is it possible that the pointer h.pd_buffer is at a wrong
alignment
    //     for a struct hostent_data?
    h.pd_buflen =3D sizeof(struct hostent_data);
    memset (h.pd_buffer, 0, h.pd_buflen); <<<< add this for initializatio=
n
  }
  if (gethostbyname_r(name,&h.pd_ent,(struct hostent_data *)h.pd_buffer) =
<
0) {

Otherwise the gethostbyname_r core dumps, because third alway fills =

newly allocated memory with "garbage", which is not ok for gethostbyname_=
r
(say the man-pages)

Gruss Peter Bauer