1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

a 0 length printer data value is not a memory allocation error; fix CR601

(This used to be commit 3442c270f1bc67890f4e2de3386fcfdec610170d)
This commit is contained in:
Gerald Carter 2003-01-09 19:51:28 +00:00
parent 3419ef3fb6
commit 6df2dc56ff

View File

@ -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;