summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-08-12 14:20:40 +0000
committerGerald Carter <jerry@samba.org>2000-08-12 14:20:40 +0000
commitcf023a7ce0ba08f3b7e37fecf8219e83c04ed418 (patch)
tree8d168b29340c2c221e3d659af37ba31acd3aff5c
parent95496b974a2920369874c1cf29985723f6fc3058 (diff)
downloadsamba-cf023a7ce0ba08f3b7e37fecf8219e83c04ed418.tar.gz
samba-cf023a7ce0ba08f3b7e37fecf8219e83c04ed418.tar.bz2
samba-cf023a7ce0ba08f3b7e37fecf8219e83c04ed418.zip
fixed unistr_to_ascii to deal with NULL src strings
jerry (This used to be commit 8e95aae1709a9be28d6e25ff6f0fdc729dc09274)
-rw-r--r--source3/lib/util_unistr.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 0817dcf072..b786d0c98b 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -253,26 +253,26 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len)
char *destend = dest + len;
register uint16 c;
- /* deal with NULL src strings */
if (src == NULL)
{
*dest = '\0';
+ return;
}
- else
+
+ /* normal code path for a valid 'src' */
+ while (dest < destend)
{
- while (dest < destend)
- {
- c = *(src++);
- if (c == 0)
- {
- break;
- }
-
- *(dest++) = (char)c;
- }
-
- *dest = 0;
+ c = *(src++);
+ if (c == 0)
+ {
+ break;
+ }
+
+ *(dest++) = (char)c;
}
+
+ *dest = 0;
+ return;
}
/*******************************************************************