summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-09 19:49:14 +0000
committerGerald Carter <jerry@samba.org>2003-01-09 19:49:14 +0000
commitd221b11bc6d62663544d0580321d088152332ec4 (patch)
tree7642557a7d005549bce585ce81183d1a34ffe9f7 /source3
parent195ec103d6c0f8470141014dbfe365996fa0f4a7 (diff)
downloadsamba-d221b11bc6d62663544d0580321d088152332ec4.tar.gz
samba-d221b11bc6d62663544d0580321d088152332ec4.tar.bz2
samba-d221b11bc6d62663544d0580321d088152332ec4.zip
a 0 length printer data value is not a memory allocation error; fix CR601
(This used to be commit 47c1709425e0c8c1e57d95dd4441b1424a5b914c)
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;