summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-03-29 22:56:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:47 -0500
commit621f91c693ba6db628087433c6899bec37c85f0a (patch)
treefc1d43f7dcaa64dfedac26fa8cae6ffafc8223d4
parent68dcff3f3a4a497a342c18844b57af14912b1570 (diff)
downloadsamba-621f91c693ba6db628087433c6899bec37c85f0a.tar.gz
samba-621f91c693ba6db628087433c6899bec37c85f0a.tar.bz2
samba-621f91c693ba6db628087433c6899bec37c85f0a.zip
r14770: Fix coverity bug #257. Possible null deref.
Jeremy. (This used to be commit 4c126ef65dd07352ab936fff774c7435723f5395)
-rw-r--r--source3/rpc_parse/parse_misc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 037764e138..8cd6553a03 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -884,6 +884,10 @@ void init_unistr2(UNISTR2 *str, const char *buf, enum unistr2_term_codes flags)
void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags)
{
uni4->string = TALLOC_P( get_talloc_ctx(), UNISTR2 );
+ if (!uni4->string) {
+ smb_panic("init_unistr4: talloc fail\n");
+ return;
+ }
init_unistr2( uni4->string, buf, flags );
uni4->length = 2 * (uni4->string->uni_str_len);
@@ -893,6 +897,10 @@ void init_unistr4(UNISTR4 *uni4, const char *buf, enum unistr2_term_codes flags)
void init_unistr4_w( TALLOC_CTX *ctx, UNISTR4 *uni4, const smb_ucs2_t *buf )
{
uni4->string = TALLOC_P( ctx, UNISTR2 );
+ if (!uni4->string) {
+ smb_panic("init_unistr4_w: talloc fail\n");
+ return;
+ }
init_unistr2_w( ctx, uni4->string, buf );
uni4->length = 2 * (uni4->string->uni_str_len);
@@ -919,7 +927,7 @@ void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf)
str->buffer = TALLOC_ZERO_ARRAY(ctx, uint16, len + 1);
if (str->buffer == NULL) {
- smb_panic("init_unistr2_w: malloc fail\n");
+ smb_panic("init_unistr2_w: talloc fail\n");
return;
}