From d7ad31cdea8fa2ad1f71968388305960076e387f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 29 Jul 2002 13:24:56 +0000 Subject: merge from SAMBA_2_2 (This used to be commit c268ae460e7e6fe25b6ac1583ea6d2f233c27d0f) --- source3/rpc_server/srv_spoolss_nt.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 46aebbe3a3..4691cbee01 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -8234,7 +8234,6 @@ WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_ while (get_specific_param_by_index(*printer, 2, param_index, value, &data, &type, &data_len)) { PRINTER_ENUM_VALUES *ptr; - uint32 add_len = 0; DEBUG(10,("retrieved value number [%d] [%s]\n", num_entries, value)); @@ -8245,19 +8244,26 @@ WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_ goto done; } enum_values = ptr; + + ZERO_STRUCTP( &enum_values[num_entries] ); /* copy the data */ + init_unistr(&enum_values[num_entries].valuename, value); enum_values[num_entries].value_len = (strlen(value)+1) * 2; enum_values[num_entries].type = type; - if (!(enum_values[num_entries].data=talloc_zero(p->mem_ctx, data_len+add_len))) { - DEBUG(0,("talloc_realloc failed to allocate more memory for data!\n")); - result = WERR_NOMEM; - goto done; + if ( data_len ) + { + if ( !(enum_values[num_entries].data = talloc_zero(p->mem_ctx, data_len)) ) { + DEBUG(0,("talloc_realloc failed to allocate more memory [data_len=%d] for data!\n", data_len )); + result = WERR_NOMEM; + goto done; + } + memcpy(enum_values[num_entries].data, data, data_len); } - memcpy(enum_values[num_entries].data, data, data_len); - enum_values[num_entries].data_len = data_len + add_len; + + enum_values[num_entries].data_len = data_len; /* keep track of the size of the array in bytes */ -- cgit