summaryrefslogtreecommitdiffstats
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
commit8e95aae1709a9be28d6e25ff6f0fdc729dc09274 (patch)
tree4c399fb60c594e398d2d4c359213e0497ef57b60
parent233b9cffa2350552d9f775f791d5d5e0464a1ed4 (diff)
downloadsamba-8e95aae1709a9be28d6e25ff6f0fdc729dc09274.tar.gz
samba-8e95aae1709a9be28d6e25ff6f0fdc729dc09274.tar.xz
samba-8e95aae1709a9be28d6e25ff6f0fdc729dc09274.zip
fixed unistr_to_ascii to deal with NULL src strings
jerry
-rw-r--r--source/lib/util_unistr.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index 0817dcf072f..b786d0c98bb 100644
--- a/source/lib/util_unistr.c
+++ b/source/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;
}
/*******************************************************************