summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-10-14 21:46:32 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:00 -0500
commitd45d113659e31977630c410db1253de47bb34bd4 (patch)
treecadb411f4638dd191bb31779a32e5310f7d4ea6c /source3
parent5b52e4a0eb8cd4a68eb35114576ccc0ae85c2a1a (diff)
downloadsamba-d45d113659e31977630c410db1253de47bb34bd4.tar.gz
samba-d45d113659e31977630c410db1253de47bb34bd4.tar.bz2
samba-d45d113659e31977630c410db1253de47bb34bd4.zip
r11073: safety checks on pointers to prevent crashing when converting REG_MULTI_SZ
(This used to be commit db8d85aa1ec5c486f061f97627b6b18a0e17cd34)
Diffstat (limited to 'source3')
-rw-r--r--source3/registry/reg_util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/registry/reg_util.c b/source3/registry/reg_util.c
index 4338699c00..511e9b4335 100644
--- a/source3/registry/reg_util.c
+++ b/source3/registry/reg_util.c
@@ -137,7 +137,10 @@ int regval_convert_multi_sz( uint16 *multi_string, size_t multi_len, char ***val
uint16 *wp;
*values = NULL;
-
+
+ if ( !multi_string || !*values )
+ return 0;
+
/* just count the NULLs */
for ( i=0; (i<multi_len-1) && !(multi_string[i]==0x0 && multi_string[i+1]==0x0); i++ ) {
@@ -183,6 +186,9 @@ size_t regval_build_multi_sz( char **values, uint16 **buffer )
size_t buf_size = 0;
uint16 *buf, *b;
UNISTR2 sz;
+
+ if ( !values || !*buffer )
+ return 0;
/* go ahead and alloc some space */