summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-03-31 00:59:58 +0000
committerGerald Carter <jerry@samba.org>2003-03-31 00:59:58 +0000
commita97a1d5fed2af91ba4d2c5cf2c82140aef98989d (patch)
treee54fcb12ea5af1b5191e6b842465f712aa90101d /source3/rpc_server
parentf1412e8e778ce9eb7fbb7f94521a4c8e59979535 (diff)
downloadsamba-a97a1d5fed2af91ba4d2c5cf2c82140aef98989d.tar.gz
samba-a97a1d5fed2af91ba4d2c5cf2c82140aef98989d.tar.bz2
samba-a97a1d5fed2af91ba4d2c5cf2c82140aef98989d.zip
add a few error checks in EnumPrinterData()
(This used to be commit 6cd74dea086aa6e0936719f6e2829494c4688ea6)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index a7b73b5ac9..0e81fa38d5 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -7572,7 +7572,7 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
int snum;
WERROR result;
- REGISTRY_VALUE *val;
+ REGISTRY_VALUE *val = NULL;
NT_PRINTER_DATA *p_data;
int i, key_index, num_values;
int name_length;
@@ -7610,7 +7610,7 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
* cf: MSDN EnumPrinterData remark section
*/
- if ( !in_value_len && !in_data_len )
+ if ( !in_value_len && !in_data_len && (key_index != -1) )
{
DEBUGADD(6,("Activating NT mega-hack to find sizes\n"));
@@ -7650,8 +7650,9 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
* the value len is wrong in NT sp3
* that's the number of bytes not the number of unicode chars
*/
-
- val = regval_ctr_specific_value( &p_data->keys[key_index].values, idx );
+
+ if ( key_index != -1 )
+ val = regval_ctr_specific_value( &p_data->keys[key_index].values, idx );
if ( !val )
{