On Mon, 2013-01-07 at 10:43 +0100, Pavel Březina wrote:
Hi,
0001:
adds macro for validating record length
This macro is based on sss_mc_is_valid_rec() + checks that length is
not
0. I didn't find any min value. If there is any, please tell me.
The minimum value is de-facto MC_HEADER_SIZE, as we need at least a full
header for any record. So you can check for len < MC_HEADER_SIZE and
fail.
Ah btw I was fooled while reading the macro, I think it would be much
more readbale if you write the past term as:
MC_PTR_DIFF(rec, (mc_ctx)->data_table)
It took me more than I should have to read it correctly, and a clear
MC_PTR_DIFF in there would make it immediately evident you are also
discounting the space *before* the record by taking the base.
(And to be honest it would be nice to fix MC_PTR_TO_SLOT() the same way
now that I look at it).
0002:
fixes the null dereference. I'm not quite sure if it is possible to
use
struct sss_cli_mc_ctx->dt_size and data_table to validate the length.
Are those fields identical to those in struct sss_mc_ctx?
ACK n.2.
Simo.
--
Simo Sorce * Red Hat, Inc * New York