diff options
-rw-r--r-- | source3/lib/util_unistr.c | 28 |
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; } /******************************************************************* |