From 55c45110e6994fe95867f4df3243c6829116e093 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 18 Mar 2010 14:06:13 +1100 Subject: charset: fixed a problem with the global use of the iconv_convenience structure We had a crash bug where a cached copy of a iconv convenience pointer was used after being freed when loadparm asked for iconv to reload. This could happen if a python module used a iconv based function before loadparm was completed. The fix is to ensure that any use of this pointer remains valid, by reusing the pointer itself when it has already been initialised, but filling in the child elements with the updated values. --- pidl/tests/ndr_string.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pidl/tests') diff --git a/pidl/tests/ndr_string.pl b/pidl/tests/ndr_string.pl index 7b76c7b295..e00dd01c8e 100755 --- a/pidl/tests/ndr_string.pl +++ b/pidl/tests/ndr_string.pl @@ -15,7 +15,7 @@ test_samba4_ndr("string-pull-empty", uint8_t data[] = { 0x00, 0x00, 0x00, 0x00 }; DATA_BLOB b = { data, 4 }; struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); + smb_iconv_convenience_reinit(NULL, "ASCII", "UTF8", true, NULL)); struct TestString r; r.in.data = NULL; @@ -38,7 +38,7 @@ test_samba4_ndr("string-ascii-pull", \'f\', \'o\', \'o\', 0 }; DATA_BLOB b = { data, 8 }; struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); + smb_iconv_convenience_reinit(NULL, "ASCII", "UTF8", true, NULL)); struct TestString r; r.in.data = NULL; @@ -75,7 +75,7 @@ test_samba4_ndr("string-wchar-fixed-array-01", }; DATA_BLOB b = { data, sizeof(data) }; struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); + smb_iconv_convenience_reinit(NULL, "ASCII", "UTF8", true, NULL)); struct TestString r; struct TestStringStruct str; r.in.str = &str; @@ -121,7 +121,7 @@ test_samba4_ndr("string-wchar-fixed-array-02", }; DATA_BLOB b = { data, sizeof(data) }; struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); + smb_iconv_convenience_reinit(NULL, "ASCII", "UTF8", true, NULL)); struct TestString r; struct TestStringStruct str; r.in.str = &str; @@ -153,7 +153,7 @@ test_samba4_ndr("string-wchar-fixed-array-03", }; DATA_BLOB b = { data, sizeof(data) }; struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); + smb_iconv_convenience_reinit(NULL, "ASCII", "UTF8", true, NULL)); struct TestString r; struct TestStringStruct str; r.in.str = &str; @@ -175,7 +175,7 @@ test_samba4_ndr("string-out", \'f\', \'o\', \'o\', 0 }; DATA_BLOB b = { data, 8 }; struct ndr_pull *ndr = ndr_pull_init_blob(&b, NULL, - smb_iconv_convenience_init(NULL, "ASCII", "UTF8", true)); + smb_iconv_convenience_reinit(NULL, "ASCII", "UTF8", true, NULL)); struct TestString r; char *str = NULL; r.out.data = &str; -- cgit