r4668: allow the caller to invoke init_unistr2() with a NULL buffer to match previous...
authorGerald Carter <jerry@samba.org>
Tue, 11 Jan 2005 02:53:00 +0000 (02:53 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:53:51 +0000 (10:53 -0500)
source/rpc_parse/parse_misc.c

index b53f9ec98cd5e2faf8c52dc90fbd816bdd3339d4..bca40a64c829b147086d890a5d271de1a2451f09 100644 (file)
@@ -895,7 +895,15 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags)
        if (buf) {
                /* We always null terminate the copy. */
                len = strlen(buf) + 1;
+       } else {
+               /* no buffer -- nothing to do */
+               str->uni_max_len = 0;
+               str->offset = 0;
+               str->uni_str_len = 0;
+
+               return;
        }
+       
 
        str->buffer = TALLOC_ZERO_ARRAY(get_talloc_ctx(), uint16, len);
        if (str->buffer == NULL) {