#48858 Segfault during ldapmodify of nsslapd-rootpw
Closed: Fixed None Opened 4 years ago by firstyear.

Thread 9 "ns-slapd" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f737b7d7700 (LWP 15864)]
0x00007f7390cdbd55 in hash_rootpw (mods=0x60300087be90) at /home/wibrown/development/389ds/ds/ldap/servers/slapd/modify.c:1439
1439            for (j = 0; mod->mod_bvalues[j] != NULL; j++) {
(gdb) bt
#0  0x00007f7390cdbd55 in hash_rootpw (mods=0x60300087be90) at /home/wibrown/development/389ds/ds/ldap/servers/slapd/modify.c:1439
#1  0x00007f7390cd9da6 in op_shared_modify (pb=0x7f737b7d69f0, pw_change=0, old_pw=0x0) at /home/wibrown/development/389ds/ds/ldap/servers/slapd/modify.c:1045
#2  0x00007f7390cd7125 in do_modify (pb=0x7f737b7d69f0) at /home/wibrown/development/389ds/ds/ldap/servers/slapd/modify.c:387
#3  0x000000000041f536 in connection_dispatch_operation (conn=0x7f737b7df200, op=0x61400004de40, pb=0x7f737b7d69f0) at /home/wibrown/development/389ds/ds/ldap/servers/slapd/connection.c:627
#4  0x0000000000424fff in connection_threadmain () at /home/wibrown/development/389ds/ds/ldap/servers/slapd/connection.c:1759
#5  0x00007f738e3427df in _pt_root (arg=0x612000091cc0) at ../../../nspr/pr/src/pthreads/ptthread.c:216
#6  0x00007f738e1036ca in start_thread (arg=0x7f737b7d7700) at pthread_create.c:333
#7  0x00007f738de3cccf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:105

Ack, you could also just adjust the for loop:

{{{
for (j = 0; mod->mod_bvalues[j] != NULL; j++) {
}}}

to

{{{
for (j = 0; mod->mod_bvalues && mod->mod_bvalues[j]; j++) {
}}}

But it makes no real difference.

Replying to [comment:2 mreynolds]:

Ack, you could also just adjust the for loop:
<<snip>>
I like Mark's one line fix. ;)

Yes, but don't we end up checking mod->mod_bvalues ever iteration?

Replying to [comment:4 firstyear]:

Yes, but don't we end up checking mod->mod_bvalues ever iteration?
??? It looks to me your patch and Mark's proposal would do the same thing.
Just the coding style difference, isn't it?

My patch checks bvalues is not null once, then we iterate.

Marks will check bvalues != NULL every iteration. So on a large bvalues list it would do (un-needed) checks.

It's a tiny, tiny little difference, but I'm a perfectionist like that :)

Ok. Please check in your patch.

commit a441a58
Writing objects: 100% (6/6), 891 bytes | 0 bytes/s, done.
Total 6 (delta 4), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
0058504..a441a58 master -> master

Metadata Update from @nhosoi:
- Issue assigned to firstyear
- Issue set to the milestone: 1.3.5.5

3 years ago

Login to comment on this ticket.

Metadata