diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-03-31 10:32:52 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-03-31 02:40:31 +0200 |
commit | b3ffcf888ca5c72b403e696d556e5af35a95534f (patch) | |
tree | 34e69b943d6bab260aa10b1003ec7c28c743351f /lib | |
parent | 7fe9bb8c8410ce47c6256e2430905988ca3429a0 (diff) | |
download | samba-b3ffcf888ca5c72b403e696d556e5af35a95534f.tar.gz samba-b3ffcf888ca5c72b403e696d556e5af35a95534f.tar.bz2 samba-b3ffcf888ca5c72b403e696d556e5af35a95534f.zip |
lib/util/charset smb_panic() on incorrect use of strlen_m_ext
This may save a developer some time in the future.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Thu Mar 31 02:40:31 CEST 2011 on sn-devel-104
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/charset/util_str.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/util/charset/util_str.c b/lib/util/charset/util_str.c index 9aaf651589..f36c91eef3 100644 --- a/lib/util/charset/util_str.c +++ b/lib/util/charset/util_str.c @@ -145,6 +145,24 @@ _PUBLIC_ size_t strlen_m_ext_handle(struct smb_iconv_handle *ic, { size_t count = 0; +#ifdef DEVELOPER + switch (dst_charset) { + case CH_DOS: + case CH_UNIX: + case CH_DISPLAY: + smb_panic("cannot call strlen_m_ext() with a variable dest charset (must be UTF16* or UTF8)"); + default: + break; + } + + switch (src_charset) { + case CH_UTF16LE: + case CH_UTF16BE: + smb_panic("cannot call strlen_m_ext() with a UTF16 src charset (must be DOS, UNIX, DISPLAY or UTF8)"); + default: + break; + } +#endif if (!s) { return 0; } |