summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-08-10 14:00:05 +0000
committerGerald Carter <jerry@samba.org>2000-08-10 14:00:05 +0000
commitf488740112449ca49d75d411a920edc6a605ff02 (patch)
treec7d206e491dd5102458a3d1af87191c466e41ca1 /source3
parent0a86b83a86acbc048345bf0ddf6d0196ddc5b042 (diff)
downloadsamba-f488740112449ca49d75d411a920edc6a605ff02.tar.gz
samba-f488740112449ca49d75d411a920edc6a605ff02.tar.bz2
samba-f488740112449ca49d75d411a920edc6a605ff02.zip
Deal will NULL UNISTR in unistr_to_ascii
jerry (This used to be commit cfa4c878a2ccaf346940f8f4a201737e185f76d6)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_unistr.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 42f1dc0644..0817dcf072 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -252,19 +252,27 @@ void unistr_to_ascii(char *dest, const uint16 *src, int len)
{
char *destend = dest + len;
register uint16 c;
-
- while (dest < destend)
- {
- c = *(src++);
- if (c == 0)
- {
- break;
- }
-
- *(dest++) = (char)c;
- }
-
- *dest = 0;
+
+ /* deal with NULL src strings */
+ if (src == NULL)
+ {
+ *dest = '\0';
+ }
+ else
+ {
+ while (dest < destend)
+ {
+ c = *(src++);
+ if (c == 0)
+ {
+ break;
+ }
+
+ *(dest++) = (char)c;
+ }
+
+ *dest = 0;
+ }
}
/*******************************************************************