summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-09 19:51:28 +0000
committerGerald Carter <jerry@samba.org>2003-01-09 19:51:28 +0000
commit6df2dc56fff6791099652575d022a2892423d65d (patch)
tree004ba30ff9f23935160688b58eb0bc2c73aae01b /source3
parent3419ef3fb6afce11e4c0016182ac3fe9cdef7340 (diff)
downloadsamba-6df2dc56fff6791099652575d022a2892423d65d.tar.gz
samba-6df2dc56fff6791099652575d022a2892423d65d.tar.bz2
samba-6df2dc56fff6791099652575d022a2892423d65d.zip
a 0 length printer data value is not a memory allocation error; fix CR601
(This used to be commit 3442c270f1bc67890f4e2de3386fcfdec610170d)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 291ed50ddd..279bbb86ff 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -2104,8 +2104,16 @@ static WERROR get_printer_dataex( TALLOC_CTX *ctx, NT_PRINTER_INFO_LEVEL *printe
if ( in_size ) {
data_len = (size > in_size) ? in_size : size*sizeof(uint8);
- if ( (*data = (uint8 *)talloc_memdup(ctx, regval_data_p(val), data_len)) == NULL )
- return WERR_NOMEM;
+
+ /* special case for 0 length values */
+ if ( data_len ) {
+ if ( (*data = (uint8 *)talloc_memdup(ctx, regval_data_p(val), data_len)) == NULL )
+ return WERR_NOMEM;
+ }
+ else {
+ if ( (*data = (uint8 *)talloc_zero(ctx, in_size)) == NULL )
+ return WERR_NOMEM;
+ }
}
else
*data = NULL;