[Date Prev][Date Next] [Chronological] [Thread] [Top]

Error: variable scope in os-ip.c


  OpenLDAP v2.1.12, Windows compilation with MSVC 6.0.

  In the file libraries/libldap/os-ip.c, line 430:

      if (! inet_aton( host, &in) ) {
          int local_h_errno;
          struct hostent he_buf;
          rc = ldap_pvt_gethostbyname_a(host, &he_buf, &ha_buf,
                  &hp, &local_h_errno);
  When succeeded function assigns to hp pointer to the he_buf
  Sorry, I'm not sure about pure C, but on my configuration when
  variable he_buf goes out of scope it's value can be overriden with
  another declaration. Actually I get access violations in release
  build on the line 471:
      q = use_hp ? (char *)hp->h_addr_list[i] : (char *)&address;

  Can you please confirm this is a bug, or have I missed some crucial
  point in my configuration to get rid of this problem?