summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-03-30 13:08:31 -0700
committerJeremy Allison <jra@samba.org>2011-03-30 23:59:37 +0200
commitc109a70531de72eef30a695248b91704bd0c7c24 (patch)
tree29182afa1ae334e8aee0e71e59aa1a0e5de65f6a /source4/torture
parent9ede19fdccaf09303012208129a093197403ef2c (diff)
downloadsamba-c109a70531de72eef30a695248b91704bd0c7c24.tar.gz
samba-c109a70531de72eef30a695248b91704bd0c7c24.tar.bz2
samba-c109a70531de72eef30a695248b91704bd0c7c24.zip
Fix convert_string() to take a *converted_size arg. and return a bool.
Makes these interfaces much harder to misuse and easier to ensure error checking. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Mar 30 23:59:37 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/utable.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source4/torture/basic/utable.c b/source4/torture/basic/utable.c
index eaa3f39e9c..d5b808244d 100644
--- a/source4/torture/basic/utable.c
+++ b/source4/torture/basic/utable.c
@@ -50,9 +50,15 @@ bool torture_utable(struct torture_context *tctx,
SSVAL(c2, 0, c);
strncpy(fname, "\\utable\\x", sizeof(fname)-1);
p = fname+strlen(fname);
- len = convert_string(CH_UTF16, CH_UNIX,
+ len = 0;
+ if (!convert_string(CH_UTF16, CH_UNIX,
c2, 2,
- p, sizeof(fname)-strlen(fname));
+ p, sizeof(fname)-strlen(fname), &len)) {
+ torture_comment(tctx, "convert_string failed [%s]\n",
+ fname);
+ continue;
+ }
+
p[len] = 0;
strncat(fname,"_a_long_extension",sizeof(fname)-1);
@@ -103,17 +109,17 @@ static char *form_name(int c)
static char fname[256];
uint8_t c2[4];
char *p;
- size_t len;
+ size_t len = 0;
strncpy(fname, "\\utable\\", sizeof(fname)-1);
p = fname+strlen(fname);
SSVAL(c2, 0, c);
- len = convert_string(CH_UTF16, CH_UNIX,
+ if (!convert_string(CH_UTF16, CH_UNIX,
c2, 2,
- p, sizeof(fname)-strlen(fname));
- if (len == -1)
+ p, sizeof(fname)-strlen(fname), &len)) {
return NULL;
+ }
p[len] = 0;
return fname;
}