Projects
home:jankowalsky:branches:home:connyhald:branches:Kolab:3.3:Updates
cyrus-imapd
ptloader-segfault.patch
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ptloader-segfault.patch of Package cyrus-imapd
--- a/ptclient/ldap.c +++ b/ptclient/ldap.c @@ -630,55 +630,46 @@ static int ptsmodule_escape( static int *ptsmodule_standard_root_dn(const char *domain, const char **result) { - /* number of dots */ - int dots; /* the expected length of the result */ - int root_dn_len; char *buf; char *part; char *ptr; + char *dc=",dc="; + char *dn; + dn = xzmalloc(1024); + buf = xzmalloc(1024); + buf[0] = '\0'; // (?) + dn[0] = '\0'; // (?) syslog(LOG_DEBUG, "ptsmodule_standard_root_dn called for domain %s", domain); - for (dots = 0, buf=(char *)domain; *buf; buf++) { - if (*buf == '.') { - dots++; - } - } - - /* Each dot is to be replaced with ',dc=' (length 4), so add - * length 3 for each of them. - */ - root_dn_len = strlen(domain) + (dots * 3); + strncpy(dn, domain, strlen(domain)); - buf = xmalloc(root_dn_len); - buf[0] = '\0'; // (?) - /* AM: Above: Terminate the string by default, so strlen won't buffer-overflow later */ /* AM: No need for another allocation/dup */ - part = strtok_r(domain, ".", &ptr); + part = strtok_r(dn, ".", &ptr); while (part != NULL) { - syslog(LOG_DEBUG, "Root DN now %s", buf); - strcat(buf, ",dc="); - syslog(LOG_DEBUG, "Root DN now %s", buf); - strcat(buf, part); - syslog(LOG_DEBUG, "Root DN now %s", buf); - part = strtok_r(NULL, ".", &ptr); + syslog(LOG_DEBUG, "Root DN now %s", buf); + strncat(buf, dc, strlen(dc)); + syslog(LOG_DEBUG, "Root DN now %s", buf); + strncat(buf, part, strlen(part)); + syslog(LOG_DEBUG, "Root DN now %s", buf); + part = strtok_r(NULL, ".", &ptr); } syslog(LOG_DEBUG, "Root DN now %s", buf); if (buf[0] == ',') - memmove(buf, buf+1, strlen(buf)); + memmove(buf, buf+1, strlen(buf)); *result = xstrdup(buf); free(buf); free(part); + free(dn); /* free(ptr); - free(root_dn_len); */ syslog(LOG_DEBUG, "Root DN now %s", *result);
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.