summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-03-31 18:29:30 -0700
committerKarolin Seeger <kseeger@samba.org>2009-04-01 13:20:49 +0200
commit476f2e1f68effbfef8c2281e125c12df75929527 (patch)
tree3640994ca27422e455c12b4b93e9d27f384c8c64
parentaf0163fdfc774f3a032610aadbc1203a770970dc (diff)
downloadsamba-476f2e1f68effbfef8c2281e125c12df75929527.tar.gz
samba-476f2e1f68effbfef8c2281e125c12df75929527.tar.xz
samba-476f2e1f68effbfef8c2281e125c12df75929527.zip
Tidy up some convert_string_internal error cases, found by Andrew Bartlett.
Jeremy. (cherry picked from commit 3797ddb3acc713cc200114e9e27dfb3901e5cdf1)
-rw-r--r--source/lib/charcnv.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/source/lib/charcnv.c b/source/lib/charcnv.c
index e51c33d7cd6..a4f32762980 100644
--- a/source/lib/charcnv.c
+++ b/source/lib/charcnv.c
@@ -242,7 +242,7 @@ static size_t convert_string_internal(charset_t from, charset_t to,
DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
if (allow_bad_conv)
goto use_as_is;
- break;
+ return (size_t)-1;
case E2BIG:
reason="No more room";
if (!conv_silent) {
@@ -263,11 +263,12 @@ static size_t convert_string_internal(charset_t from, charset_t to,
DEBUG(3,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
if (allow_bad_conv)
goto use_as_is;
- break;
+
+ return (size_t)-1;
default:
if (!conv_silent)
DEBUG(0,("convert_string_internal: Conversion error: %s(%s)\n",reason,inbuf));
- break;
+ return (size_t)-1;
}
/* smb_panic(reason); */
}
@@ -412,7 +413,11 @@ size_t convert_string(charset_t from, charset_t to,
#ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS
goto general_case;
#else
- return retval + convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
+ size_t ret = convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
+ if (ret == (size_t)-1) {
+ return ret;
+ }
+ return retval + ret;
#endif
}
}
@@ -448,7 +453,11 @@ size_t convert_string(charset_t from, charset_t to,
#ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS
goto general_case;
#else
- return retval + convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
+ size_t ret = convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
+ if (ret == (size_t)-1) {
+ return ret;
+ }
+ return retval + ret;
#endif
}
}
@@ -484,7 +493,11 @@ size_t convert_string(charset_t from, charset_t to,
#ifdef BROKEN_UNICODE_COMPOSE_CHARACTERS
goto general_case;
#else
- return retval + convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
+ size_t ret = convert_string_internal(from, to, p, slen, q, dlen, allow_bad_conv);
+ if (ret == (size_t)-1) {
+ return ret;
+ }
+ return retval + ret;
#endif
}
}