#140 incorrect memset() call in back-ldbm/perfctrs.c
Closed: wontfix None Opened 12 years ago by mkosek.

https://bugzilla.redhat.com/show_bug.cgi?id=210381

In back-ldbm/perfctrs.c in the init_shared_memory() function, memset() is
called
with the 2nd and 3rd parameters reversed:

  memset(perf,sizeof(performance_counters),0);

It looks like init_shared_memory() is only called on Windows (where the
performance counters reside in shared memory instead of process memory).  I am
not sure if this causes any problems or not; perhaps the memory is cleared
elsewhere.

I found this using Google code search in someone's tarball of Fedora DS 1.02
and
then I confirmed this still exists in the trunk code by using lxr.

Sorry, but let me reopen this ticket not to forget to put it back...

The bug was fixed by this patch independently from the bugzilla 210381.

commit 4fc63ed
Author: Rich Megginson rmeggins@redhat.com
Date: Wed Aug 8 14:04:45 2007 +0000

The arguments to memset were in the wrong order.  This code is only used on Windows.

This is the contents of the patch:

$ git diff c7812a2 4fc63ed perfctrs.c
diff --git a/ldap/servers/slapd/back-ldbm/perfctrs.c b/ldap/servers/slapd/back-ldbm/perfct
index 21ca5e5..13fda0d 100644
--- a/ldap/servers/slapd/back-ldbm/perfctrs.c
+++ b/ldap/servers/slapd/back-ldbm/perfctrs.c
@@ -103,7 +103,7 @@ static void init_shared_memory(perfctrs_private priv)
{
performance_counters
perf = (performance_counters*)priv->memory;
if (NULL != perf) {
- memset(perf,sizeof(performance_counters),0);
+ memset(perf,0,sizeof(performance_counters));
}
}

NAME
memset - fill memory with a constant byte

SYNOPSIS
#include <string.h>
void memset(void s, int c, size_t n);

closing as this was already fixed.

does not affect redhat ds

Added initial screened field value.

Metadata Update from @mreynolds:
- Issue assigned to mreynolds
- Issue set to the milestone: 1.2.10.rc1

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/140

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Invalid)

3 years ago

Login to comment on this ticket.

Metadata