diff options
author | Gerald Carter <jerry@samba.org> | 2000-08-09 20:14:29 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2000-08-09 20:14:29 +0000 |
commit | 8ecd5dd52a6bd867f5d117352048ee43ce7254d9 (patch) | |
tree | 3400b3f5eab6a8442b4682fba143816cda8e7342 /source/rpc_parse/parse_misc.c | |
parent | 7507f6f408cf8b0f8d7e2b3da54ce5fb5ef5343b (diff) | |
download | samba-8ecd5dd52a6bd867f5d117352048ee43ce7254d9.tar.gz samba-8ecd5dd52a6bd867f5d117352048ee43ce7254d9.tar.xz samba-8ecd5dd52a6bd867f5d117352048ee43ce7254d9.zip |
More work on AddPrinterDriver() and AddPrinterEx() client RPC's
Also fixed init_unistr() to deal with a NULL source character string.
-jerry
Diffstat (limited to 'source/rpc_parse/parse_misc.c')
-rw-r--r-- | source/rpc_parse/parse_misc.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c index 617552009ce..02ab707a40b 100644 --- a/source/rpc_parse/parse_misc.c +++ b/source/rpc_parse/parse_misc.c @@ -473,21 +473,32 @@ BOOL smb_io_unihdr2(char *desc, UNIHDR2 *hdr2, prs_struct *ps, int depth) void init_unistr(UNISTR *str, const char *buf) { - size_t len = strlen(buf) + 1; + size_t len; - if (!parse_misc_talloc) + if (buf == NULL) + { + str->buffer = NULL; + return; + } + + + len = strlen(buf) + 1; + + if (!parse_misc_talloc) parse_misc_talloc = talloc_init(); if (len < MAX_UNISTRLEN) len = MAX_UNISTRLEN; len *= sizeof(uint16); - str->buffer = (uint16 *)talloc(parse_misc_talloc, len); + str->buffer = (uint16 *)talloc(parse_misc_talloc, len); if (str->buffer == NULL) smb_panic("init_unistr2: malloc fail\n"); /* store the string (null-terminated copy) */ dos_struni2((char *)str->buffer, buf, len); + + return; } /******************************************************************* |