Hi,

On Monday, September 05, 2011 10:02:25 AM Alejandro Escanero Blanco wrote:
> Valgrind give me:
> 
> ==25578== Memcheck, a memory error detector
> ==25578== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
> ==25578== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
> ==25578== Command:
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> XXX ==25578== Parent PID: 24066
> ==25578==
> --25578--
> --25578-- Valgrind options:
> --25578--    -v
> --25578--    --trace-children=yes
> --25578--    --log-file=vg.log
> --25578-- Contents of /proc/version:
> --25578--   Linux version 2.6.18-194.el5
> ([email protected]) (gcc version 4.1.2 20080704
> (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010
> --25578-- Arch and hwcaps: X86, x86-sse1-sse2
> --25578-- Page sizes: currently 4096, max supported 4096
> --25578-- Valgrind library directory: /usr/lib/valgrind
> --25578-- Reading syms from /usr/local/samba/bin/net (0x108000)
> --25578-- Reading syms from /lib/ld-2.5.so (0xb2f000)
> --25578-- Reading syms from /usr/lib/valgrind/memcheck-x86-linux
> (0x38000000)
> --25578--    object doesn't have a dynamic symbol table
> --25578-- Reading suppressions file: /usr/lib/valgrind/default.supp
> --25578-- REDIR: 0xb447d0 (index) redirected to 0x3803e483
> (vgPlain_x86_linux_REDIR_FOR_index)
> --25578-- Reading syms from
> /usr/lib/valgrind/vgpreload_core-x86-linux.so (0x4801000)
> --25578-- Reading syms from
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so (0x4803000)
> ==25578== WARNING: new redirection conflicts with existing -- ignoring it
> --25578--     new: 0x00b447d0 (index               ) R-> 0x04806640 index
> --25578-- REDIR: 0xb44970 (strlen) redirected to 0x4806820 (strlen)
> --25578-- Reading syms from /lib/libresolv-2.5.so (0x4811000)
> --25578-- Reading syms from /lib/libnsl-2.5.so (0x4824000)
> --25578-- Reading syms from /lib/libdl-2.5.so (0x483b000)
> --25578-- Reading syms from /lib/librt-2.5.so (0x4840000)
> --25578-- Reading syms from /usr/lib/libpopt.so.0.0.0 (0x4849000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/libgssapi_krb5.so.2.2 (0x4851000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/libkrb5.so.3.3 (0x487f000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/libk5crypto.so.3.1 (0x4915000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libcom_err.so.2.1 (0x493b000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libuuid.so.1.2 (0x493f000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/libldap-2.3.so.0.2.31 (0x4943000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/liblber-2.3.so.0.2.31 (0x497d000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/local/samba/lib/libtalloc.so.2.0.5
> (0x498b000)
> --25578-- Reading syms from /usr/local/samba/lib/libtdb.so.1.2.9
> (0x4994000) --25578-- Reading syms from
> /usr/local/samba/lib/libwbclient.so.0
> (0x49a5000)
> --25578-- Reading syms from /usr/lib/libz.so.1.2.3 (0x49b2000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libc-2.5.so (0x49c5000)
> --25578-- Reading syms from /lib/libpthread-2.5.so (0x4b0b000)
> --25578-- Reading syms from /usr/lib/libkrb5support.so.0.1 (0x4b23000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libkeyutils-1.2.so (0x4b2d000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/libsasl2.so.2.0.22 (0x4b30000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libssl.so.0.9.8e (0x4b49000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libcrypto.so.0.9.8e (0x4b91000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libselinux.so.1 (0x4cd2000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /lib/libcrypt-2.5.so (0x4ceb000)
> --25578-- Reading syms from /lib/libsepol.so.1 (0x4d1d000)
> --25578--    object doesn't have a symbol table
> --25578-- REDIR: 0x4a363e0 (memset) redirected to 0x4806b80 (memset)
> --25578-- REDIR: 0x4a368d0 (memcpy) redirected to 0x4807a70 (memcpy)
> --25578-- REDIR: 0x4a35540 (rindex) redirected to 0x4806550 (rindex)
> --25578-- REDIR: 0x4a30e30 (malloc) redirected to 0x480587e (malloc)
> --25578-- REDIR: 0x4a35ee0 (memchr) redirected to 0x48069f0 (memchr)
> --25578-- REDIR: 0x4a351a0 (strlen) redirected to 0x4806800 (strlen)
> --25578-- REDIR: 0x4a2e990 (free) redirected to 0x4805498 (free)
> --25578-- REDIR: 0x4a36440 (mempcpy) redirected to 0x48072d0 (mempcpy)
> --25578-- REDIR: 0x4a312a0 (realloc) redirected to 0x480592d (realloc)
> --25578-- REDIR: 0x4a34ad0 (index) redirected to 0x48065e0 (index)
> --25578-- REDIR: 0x4a30af0 (calloc) redirected to 0x4804b8e (calloc)
> --25578-- REDIR: 0x4a34c40 (strcmp) redirected to 0x48068d0 (strcmp)
> --25578-- REDIR: 0x4a35390 (strncmp) redirected to 0x4806860 (strncmp)
> --25578-- REDIR: 0x4a37250 (strchrnul) redirected to 0x4806c60 (strchrnul)
> --25578-- REDIR: 0x4a37180 (rawmemchr) redirected to 0x4806c90 (rawmemchr)
> --25578-- REDIR: 0x4a35250 (strnlen) redirected to 0x48067d0 (strnlen)
> --25578-- REDIR: 0x4a34cb0 (strcpy) redirected to 0x4807d00 (strcpy)
> --25578-- REDIR: 0x4a35490 (strncpy) redirected to 0x4807be0 (strncpy)
> --25578-- REDIR: 0x4a365d0 (stpcpy) redirected to 0x4807550 (stpcpy)
> --25578-- Reading syms from /lib/libnss_files-2.5.so (0x53a5000)
> --25578-- Reading syms from /lib/libnss_dns-2.5.so (0x53b0000)
> --25578-- REDIR: 0x4a36370 (memmove) redirected to 0x4806be0 (memmove)
> --25578-- REDIR: 0x49f0b70 (setenv) redirected to 0x4806d70 (setenv)
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E739: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E21B: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d78ed0 is 16 bytes inside a block of size 19 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x499AEAE: tdb_alloc_read (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499DE11: get_bytes (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E1E4: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E777: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E21B: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d79fb4 is 60 bytes inside a block of size 63 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x499AEAE: tdb_alloc_read (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499DE11: get_bytes (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E1E4: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E6EC: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E21B: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d7a020 is 56 bytes inside a block of size 59 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x499AEAE: tdb_alloc_read (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499DE11: get_bytes (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E1E4: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E6EC: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x4996196: tdb_parse_record (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x436BA8: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d77584 is 20 bytes inside a block of size 23 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x4A2513A: vasprintf (in /lib/libc-2.5.so)
> ==25578==    by 0x421713: asprintf_strupper_m (in /usr/local/samba/bin/net)
> ==25578==    by 0x3270DA: sitename_key (in /usr/local/samba/bin/net)
> ==25578==    by 0x32712F: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E6EC: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x4996196: tdb_parse_record (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x436BD9: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d77584 is 20 bytes inside a block of size 23 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x4A2513A: vasprintf (in /lib/libc-2.5.so)
> ==25578==    by 0x421713: asprintf_strupper_m (in /usr/local/samba/bin/net)
> ==25578==    by 0x3270DA: sitename_key (in /usr/local/samba/bin/net)
> ==25578==    by 0x32712F: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==
> --25578-- Reading syms from /usr/lib/gconv/UTF-16.so (0x53f6000)
> --25578--    object doesn't have a symbol table
> --25578-- Reading syms from /usr/lib/gconv/IBM850.so (0x53fa000)
> --25578--    object doesn't have a symbol table
> --25578-- REDIR: 0xb44d30 (stpcpy) redirected to 0x4807480 (stpcpy)
> ==25578== Invalid read of size 1
> ==25578==    at 0x42481E: strlen_w (in /usr/local/samba/bin/net)
> ==25578==    by 0x415766: pull_ucs2_talloc (in /usr/local/samba/bin/net)
> ==25578==    by 0x2B949C: reg_format_value (in /usr/local/samba/bin/net)
> ==25578==    by 0x2B9762: reg_format_regval_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1DDA68: registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DDFAC: rpc_registry_export_internal (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3863: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC4E0: net_rpc_registry (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==    by 0x1B6DD4: net_rpc (in /usr/local/samba/bin/net)
> ==25578==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
> ==25578==
> ==25578==
> ==25578== Process terminating with default action of signal 11 (SIGSEGV)
> ==25578==  Access not within mapped region at address 0x0
> ==25578==    at 0x42481E: strlen_w (in /usr/local/samba/bin/net)
> ==25578==    by 0x415766: pull_ucs2_talloc (in /usr/local/samba/bin/net)
> ==25578==    by 0x2B949C: reg_format_value (in /usr/local/samba/bin/net)
> ==25578==    by 0x2B9762: reg_format_regval_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1DDA68: registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DDFAC: rpc_registry_export_internal (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3863: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC4E0: net_rpc_registry (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==    by 0x1B6DD4: net_rpc (in /usr/local/samba/bin/net)
> ==25578==  If you believe this happened as a result of a stack
> ==25578==  overflow in your program's main thread (unlikely but
> ==25578==  possible), you can try to increase the size of the
> ==25578==  main thread stack using the --main-stacksize= flag.
> ==25578==  The main thread stack size used in this run was 10485760.
> --25578-- Discarding syms at 0x53fa300-0x53fae64 in
> /usr/lib/gconv/IBM850.so due to munmap()
> --25578-- Discarding syms at 0x53f63d0-0x53f79d4 in
> /usr/lib/gconv/UTF-16.so due to munmap()
> --25578-- Discarding syms at 0x53a68c0-0x53ad264 in
> /lib/libnss_files-2.5.so due to munmap()
> --25578-- Discarding syms at 0x53b0ba0-0x53b3704 in
> /lib/libnss_dns-2.5.so due to munmap()
> ==25578==
> ==25578== HEAP SUMMARY:
> ==25578==     in use at exit: 429,268 bytes in 399 blocks
> ==25578==   total heap usage: 7,083 allocs, 6,684 frees, 1,247,176 bytes
> allocated
> ==25578==
> ==25578== Searching for pointers to 399 not-freed blocks
> ==25578== Checked 578,868 bytes
> ==25578==
> ==25578== LEAK SUMMARY:
> ==25578==    definitely lost: 2 bytes in 1 blocks
> ==25578==    indirectly lost: 0 bytes in 0 blocks
> ==25578==      possibly lost: 423,183 bytes in 285 blocks
> ==25578==    still reachable: 6,083 bytes in 113 blocks
> ==25578==         suppressed: 0 bytes in 0 blocks
> ==25578== Rerun with --leak-check=full to see details of leaked memory
> ==25578==
> ==25578== ERROR SUMMARY: 496 errors from 6 contexts (suppressed: 71 from
> 10) ==25578==
> ==25578== 1 errors in context 1 of 6:
> ==25578== Invalid read of size 1
> ==25578==    at 0x42481E: strlen_w (in /usr/local/samba/bin/net)
> ==25578==    by 0x415766: pull_ucs2_talloc (in /usr/local/samba/bin/net)
> ==25578==    by 0x2B949C: reg_format_value (in /usr/local/samba/bin/net)
> ==25578==    by 0x2B9762: reg_format_regval_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1DDA68: registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DDFAC: rpc_registry_export_internal (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3863: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC4E0: net_rpc_registry (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==    by 0x1B6DD4: net_rpc (in /usr/local/samba/bin/net)
> ==25578==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
> ==25578==
> ==25578==
> ==25578== 1 errors in context 2 of 6:
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E6EC: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x4996196: tdb_parse_record (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x436BD9: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d77584 is 20 bytes inside a block of size 23 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x4A2513A: vasprintf (in /lib/libc-2.5.so)
> ==25578==    by 0x421713: asprintf_strupper_m (in /usr/local/samba/bin/net)
> ==25578==    by 0x3270DA: sitename_key (in /usr/local/samba/bin/net)
> ==25578==    by 0x32712F: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==
> ==25578==
> ==25578== 1 errors in context 3 of 6:
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E6EC: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x4996196: tdb_parse_record (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x436BA8: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d77584 is 20 bytes inside a block of size 23 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x4A2513A: vasprintf (in /lib/libc-2.5.so)
> ==25578==    by 0x421713: asprintf_strupper_m (in /usr/local/samba/bin/net)
> ==25578==    by 0x3270DA: sitename_key (in /usr/local/samba/bin/net)
> ==25578==    by 0x32712F: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==    by 0x1DC594: rpc_registry_export (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB431: net_run_function (in /usr/local/samba/bin/net)
> ==25578==
> ==25578==
> ==25578== 36 errors in context 4 of 6:
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E777: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E21B: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d79fb4 is 60 bytes inside a block of size 63 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x499AEAE: tdb_alloc_read (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499DE11: get_bytes (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E1E4: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==
> ==25578==
> ==25578== 72 errors in context 5 of 6:
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E6EC: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E21B: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d7a020 is 56 bytes inside a block of size 59 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x499AEAE: tdb_alloc_read (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499DE11: get_bytes (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E1E4: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==
> ==25578==
> ==25578== 385 errors in context 6 of 6:
> ==25578== Invalid read of size 4
> ==25578==    at 0x499E739: tdb_jenkins_hash (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E21B: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1EC4C7: net_make_ipc_connection (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x1C3505: run_rpc_command (in /usr/local/samba/bin/net)
> ==25578==  Address 0x4d78ed0 is 16 bytes inside a block of size 19 alloc'd
> ==25578==    at 0x4805903: malloc (vg_replace_malloc.c:195)
> ==25578==    by 0x499AEAE: tdb_alloc_read (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499DE11: get_bytes (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x499E1E4: tdb_check (in
> /usr/local/samba/lib/libtdb.so.1.2.9)
> ==25578==    by 0x435C92: gencache_init (in /usr/local/samba/bin/net)
> ==25578==    by 0x436B52: gencache_parse (in /usr/local/samba/bin/net)
> ==25578==    by 0x43704D: gencache_get_data_blob (in
> /usr/local/samba/bin/net)
> ==25578==    by 0x437118: gencache_get (in /usr/local/samba/bin/net)
> ==25578==    by 0x327147: sitename_fetch (in /usr/local/samba/bin/net)
> ==25578==    by 0x3211C9: resolve_name (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EB62D: net_find_server (in /usr/local/samba/bin/net)
> ==25578==    by 0x1EC2C6: net_make_ipc_connection_ex (in
> /usr/local/samba/bin/net)
> ==25578==
> --25578--
> --25578-- used_suppression:     71 dl-hack3
> ==25578==
> ==25578== ERROR SUMMARY: 496 errors from 6 contexts (suppressed: 71 from
> 10)
> 
> El 18/08/11 23:15, Volker Lendecke escribió:
> > On Thu, Aug 18, 2011 at 02:12:57PM -0700, Jeremy Allison wrote:
> >> On Thu, Aug 18, 2011 at 01:31:36PM +0200, Alejandro Escanero Blanco 
wrote:
> >>> I'm triing to put some samba3.6 server like print server, the load
> >>> of ntprinters and ntdrivers is ok, but when I try to do a backup of
> >>> the registry I find it:
> >>> 
> >>> #net rpc registry export
> >>> 'HKLM\System\CurrentControlSet\Control\Print\Environments\Windows NT
> >>> x86\Drivers\Version-3\Canon iR2270/iR2870 PCL6' printers.reg
> >>> Violación de segmento (Segmentation Fault)
> >>> 
> >>> Export fail but enumerate runs correctly. Where is the problem?

There are 2 problems. The first seams there are invalid REG_SZ values within 
this registry key, the second "net registry export" couldn't cope with them.
For the second problem please try the attached patch, the first needs further 
investigations.

Gregor
From 913836f0f7495c97ebf7e91044a62c425e1da6f9 Mon Sep 17 00:00:00 2001
From: Gregor Beck <[email protected]>
Date: Tue, 6 Sep 2011 09:24:10 +0200
Subject: [PATCH] s3:registry: reg_format: handle unterminated REG_SZ blobs

---
 source3/registry/reg_format.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/source3/registry/reg_format.c b/source3/registry/reg_format.c
index 266629a..315db47 100644
--- a/source3/registry/reg_format.c
+++ b/source3/registry/reg_format.c
@@ -339,6 +339,12 @@ done:
 	return ret;
 }
 
+static bool is_zero_terminated_ucs2(const uint8_t* data, size_t len) {
+	const size_t idx = len/sizeof(smb_ucs2_t);
+	const smb_ucs2_t *str = (const smb_ucs2_t*)data;
+	return (idx > 0) && (str[idx] == 0);
+}
+
 int reg_format_value(struct reg_format* f, const char* name, uint32_t type,
 		     const uint8_t* data, size_t len)
 {
@@ -347,7 +353,9 @@ int reg_format_value(struct reg_format* f, const char* name, uint32_t type,
 
 	switch (type) {
 	case REG_SZ:
-		if (!(f->hex_fmt & REG_FMT_HEX_SZ)) {
+		if (!(f->hex_fmt & REG_FMT_HEX_SZ)
+		    && is_zero_terminated_ucs2(data, len))
+		{
 			char* str = NULL;
 			size_t dlen;
 			if (pull_ucs2_talloc(mem_ctx, &str, (const smb_ucs2_t*)data, &dlen)) {
-- 
1.7.6

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba

Reply via email to