ASF Bugzilla – Attachment 21240 Details for
Bug 43942
httpd crashes while loading ldap attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch - optimized string handling in util_ldap.c
patch_43942.diff (text/plain), 2.51 KB, created by
Bernd Leinfelder
on 2007-12-06 10:44:42 UTC
(
hide
)
Description:
Patch - optimized string handling in util_ldap.c
Filename:
MIME Type:
Creator:
Bernd Leinfelder
Created:
2007-12-06 10:44:42 UTC
Size:
2.51 KB
patch
obsolete
>diff -rc httpd-2.2.6/modules/ldap/util_ldap.c httpd-2.2.6-patched/modules/ldap/util_ldap.c >*** httpd-2.2.6/modules/ldap/util_ldap.c Mon Aug 20 01:19:46 2007 >--- httpd-2.2.6-swisslife//modules/ldap/util_ldap.c Thu Dec 6 19:31:45 2007 >*************** >*** 1233,1244 **** > char **values; > int j = 0; > char *str = NULL; > /* get values */ > values = ldap_get_values(ldc->ldap, entry, attrs[i]); >! while (values && values[j]) { >! str = str ? apr_pstrcat(r->pool, str, "; ", values[j], NULL) >! : apr_pstrdup(r->pool, values[j]); > j++; > } > ldap_value_free(values); > vals[i] = str; >--- 1233,1278 ---- > char **values; > int j = 0; > char *str = NULL; >+ int len = 0; >+ int size = 0; >+ int maxsize = 0; >+ int nextsize = 0; >+ char *buffer = NULL; >+ >+ > /* get values */ > values = ldap_get_values(ldc->ldap, entry, attrs[i]); >! >! #define ATTRIBUTE_VALUE_SIZE 256 >! >! maxsize = ldap_count_values(values) * ATTRIBUTE_VALUE_SIZE; >! >! ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >! "[%" APR_PID_T_FMT "] ldap cache: allocating %i bytes for attribute values", >! getpid(), j, maxsize); >! >! buffer = apr_pcalloc(r->pool,maxsize); >! str = buffer; >! >! while (values && values[j] && nextsize < maxsize) { >! len=strlen(values[j]); >! buffer[0]=';'; >! memcpy(++buffer, values[j], len); >! buffer+=len; >! size+=len; > j++; >+ >+ nextsize=size+strlen(values[j]); >+ >+ if (nextsize >= maxsize) { >+ ap_log_error(APLOG_MARK, APLOG_WARNING , 0, r->server, >+ "[%" APR_PID_T_FMT "] ldap cache: buffer overflow while storing attributes values. attribute %s has more than %i bytes ", >+ getpid(), attrs[i], maxsize); >+ } >+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, >+ "[%" APR_PID_T_FMT "] ldap cache: vals %i size %i maxsize %i attr %s", >+ getpid(), j, size, maxsize, attrs[i]); >+ > } > ldap_value_free(values); > vals[i] = str;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43942
:
21240
|
21242