summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-03-31 01:00:34 +0000
committerGerald Carter <jerry@samba.org>2003-03-31 01:00:34 +0000
commit47f230b761f33210beab7f632e8ed1f111959aba (patch)
treec8a195961e3a0b19e8de84276b6dc9182f178920 /source3
parentb49099ec1418a6af519c5d3a8d94c2faa7da2fe2 (diff)
downloadsamba-47f230b761f33210beab7f632e8ed1f111959aba.tar.gz
samba-47f230b761f33210beab7f632e8ed1f111959aba.tar.bz2
samba-47f230b761f33210beab7f632e8ed1f111959aba.zip
add a few error checks in EnumPrinterData()
(This used to be commit 453813ec6e2c25a3f6a664212aedcad15cfd6000)
Diffstat (limited to 'source3')
-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 36ff92e46f..99711cbb13 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 )
{