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

ldap_search_s segfaults (ITS#960)



Full_Name: Mike Schiraldi
Version: 1.2.11
OS: RH Linux 7.0
URL: 
Submission from: (NULL) (216.168.254.240)


The following test program dumps core:

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <lber.h>
#include <ldap.h>

int main(int argc, const char ** argv)
{
  LDAP *ld;
  LDAPMessage * res;
  int rv;

  ld = ldap_open ("ldap.research.netsol.com", 389);
  assert(ld != NULL);

  rv = ldap_simple_bind_s (ld, NULL, NULL);
  assert(rv == 0);

  fprintf(stderr, "About to search\n");

  rv = ldap_search_s (ld, "dc=thecobblershoppe,dc=com", 
                       LDAP_SCOPE_ONELEVEL, "(objectClass=*)", 
                       NULL, 0, &res);
      
  fprintf(stderr, "Search complete\n");
 
  return 0;
}

Here's the backtrace:

#0  chunk_alloc (ar_ptr=0x40142ce0, nb=1313) at malloc.c:2882
#1  0x4009f7e6 in __libc_malloc (bytes=1304) at malloc.c:2703
#2  0x804f480 in ber_get_next (sb=0x8059ed8, len=0xbffff4f4, ber=0xbffff524)
    at io.c:553
#3  0x8049478 in read1msg (ld=0x80522f0, msgid=2, all=1, sb=0x8059ed8,
lc=0x8059a88, 
    result=0xbffff600) at result.c:283
#4  0x80493a7 in wait4msg (ld=0x80522f0, msgid=2, all=1, timeout=0x0, 
    result=0xbffff600) at result.c:232
#5  0x8049170 in ldap_result (ld=0x80522f0, msgid=2, all=1, timeout=0x0, 
    result=0xbffff600) at result.c:117
#6  0x804a848 in ldap_search_s (ld=0x80522f0, 
    base=0x804f6c8 "dc=thecobblershoppe,dc=com", scope=1, 
    filter=0x804f6b8 "(objectClass=*)", attrs=0x0, attrsonly=0, res=0xbffff600)
    at search.c:627
#7  0x8048d16 in main (argc=1, argv=0xbffff674) at test.c:23

Am i doing something wrong?