summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-11-21 19:47:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:00 -0500
commitc8951115792a8be64b294de68f47679c3c3ed28f (patch)
treeda34ed8cb86230ecb265750c25555e3274d2392a /source3
parentbb4fb75b2216f9f58e8f8fad43bc39634148b315 (diff)
downloadsamba-c8951115792a8be64b294de68f47679c3c3ed28f.tar.gz
samba-c8951115792a8be64b294de68f47679c3c3ed28f.tar.bz2
samba-c8951115792a8be64b294de68f47679c3c3ed28f.zip
r19824: Fix the max value calculation in QueryInfoKey
(This used to be commit cd14b7f05234f540601cd2c5841a52dd047c965d)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_winreg_nt.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c
index c45be08454..23b594ac78 100644
--- a/source3/rpc_server/srv_winreg_nt.c
+++ b/source3/rpc_server/srv_winreg_nt.c
@@ -163,7 +163,6 @@ static BOOL get_value_information( REGISTRY_KEY *key, uint32 *maxnum,
uint32 *maxlen, uint32 *maxsize )
{
REGVAL_CTR *values;
- REGISTRY_VALUE *val;
uint32 sizemax, lenmax;
int i, num_values;
@@ -178,15 +177,17 @@ static BOOL get_value_information( REGISTRY_KEY *key, uint32 *maxnum,
lenmax = sizemax = 0;
num_values = regval_ctr_numvals( values );
-
- val = regval_ctr_specific_value( values, 0 );
-
- for ( i=0; i<num_values && val; i++ )
- {
- lenmax = MAX(lenmax, val->valuename ? strlen(val->valuename)+1 : 0 );
+
+ for ( i=0; i<num_values; i++ ) {
+ REGISTRY_VALUE *val;
+
+ if (!(val = regval_ctr_specific_value( values, i ))) {
+ break;
+ }
+
+ lenmax = MAX(lenmax, val->valuename ?
+ strlen(val->valuename)+1 : 0 );
sizemax = MAX(sizemax, val->size );
-
- val = regval_ctr_specific_value( values, i );
}
*maxnum = num_values;