On Tue, Jan 22, 2008 at 08:38:50AM -0200, Sergio Pires wrote: > OK, I run samba 3.0.24-6etch9 from Debian 4.0 - etch. Yes, I ran under > valgrind with only verbose and log-file options. Also, my samba package is a > debian binary so I did not recompile with -g option. Here it is:
Thanks a lot! Does the attached patch help? Volker
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index c106c44..0099488 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -363,7 +363,11 @@ BOOL strisnormal(const char *s, int case_default)
NOTE: oldc and newc must be 7 bit characters
**/
-void string_replace( pstring s, char oldc, char newc )
+/**
+ String replace.
+ NOTE: oldc and newc must be 7 bit characters
+**/
+void string_replace( char *s, char oldc, char newc )
{
char *p;
@@ -375,8 +379,9 @@ void string_replace( pstring s, char oldc, char newc )
for (p = s; *p; p++) {
if (*p & 0x80) /* mb string - slow path. */
break;
- if (*p == oldc)
+ if (*p == oldc) {
*p = newc;
+ }
}
if (!*p)
@@ -387,9 +392,18 @@ void string_replace( pstring s, char oldc, char newc )
/* With compose characters we must restart from the beginning. JRA. */
p = s;
#endif
- push_ucs2(NULL, tmpbuf, p, sizeof(tmpbuf), STR_TERMINATE);
- string_replace_w(tmpbuf, UCS2_CHAR(oldc), UCS2_CHAR(newc));
- pull_ucs2(NULL, p, tmpbuf, -1, sizeof(tmpbuf), STR_TERMINATE);
+
+ while (*p) {
+ size_t c_size;
+ next_codepoint(p, &c_size);
+
+ if (c_size == 1) {
+ if (*p == oldc) {
+ *p = newc;
+ }
+ }
+ p += c_size;
+ }
}
/**
pgpfZJeQkQxx4.pgp
Description: PGP signature
-- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/listinfo/samba
