summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-01-13 12:42:20 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-01-13 12:42:20 +0000
commit20ecae9a5888c168ad05cb26d1177061f3f9378f (patch)
tree88e0b00f7741436de64bc936b2a591eaba94a238 /source3
parentac04f498a2b8ec6bc2eb06fb2f0db68c5aa2270b (diff)
downloadsamba-20ecae9a5888c168ad05cb26d1177061f3f9378f.tar.gz
samba-20ecae9a5888c168ad05cb26d1177061f3f9378f.tar.bz2
samba-20ecae9a5888c168ad05cb26d1177061f3f9378f.zip
Accessing data after it's been free()ed really is a no-no...
Andrew Bartlett (This used to be commit 6e821285a4aacfc0031957b88ddbec73d7e1dc11)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/data_blob.c1
-rw-r--r--source3/lib/util.c2
-rw-r--r--source3/lib/util_str.c18
3 files changed, 17 insertions, 4 deletions
diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c
index d690cd05a0..250c3ade88 100644
--- a/source3/lib/data_blob.c
+++ b/source3/lib/data_blob.c
@@ -84,7 +84,6 @@ void data_blob_free(DATA_BLOB *d)
if (d->free) {
(d->free)(d);
}
- ZERO_STRUCTP(d);
}
}
diff --git a/source3/lib/util.c b/source3/lib/util.c
index ec967e4abf..c572fbe265 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1013,7 +1013,7 @@ BOOL get_myfullname(char *my_name)
Get my own domain name.
****************************************************************************/
-BOOL get_mydomname(char *my_domname)
+BOOL get_mydomname(fstring my_domname)
{
pstring hostname;
char *p;
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 7ffd71bde9..4d3a808f16 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -308,8 +308,22 @@ char *skip_string(char *buf,size_t n)
size_t str_charnum(const char *s)
{
- push_ucs2(NULL, tmpbuf,s, sizeof(tmpbuf), STR_TERMINATE);
- return strlen_w(tmpbuf);
+ uint16 tmpbuf2[sizeof(pstring)];
+ push_ucs2(NULL, tmpbuf2,s, sizeof(tmpbuf2), STR_TERMINATE);
+ return strlen_w(tmpbuf2);
+}
+
+/*******************************************************************
+ Count the number of characters in a string. Normally this will
+ be the same as the number of bytes in a string for single byte strings,
+ but will be different for multibyte.
+********************************************************************/
+
+size_t str_ascii_charnum(const char *s)
+{
+ pstring tmpbuf2;
+ push_ascii(tmpbuf2, s, sizeof(tmpbuf2), STR_TERMINATE);
+ return strlen(tmpbuf2);
}
/*******************************************************************