From 08a9d98cdecfd8cac2a5b72130e30a711eddb050 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 11 Jan 2005 02:53:00 +0000 Subject: r4668: allow the caller to invoke init_unistr2() with a NULL buffer to match previous behavior; more checks to come tomorrow (This used to be commit 9a29bef056f92ef6f1df01f56c121088f84be16b) --- source3/rpc_parse/parse_misc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index b53f9ec98c..bca40a64c8 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -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) { -- cgit