On 02/21/2011 06:20 PM, Russell Bryant wrote: > On Mon, Feb 21, 2011 at 9:41 AM, Jan Friesse <[email protected]> wrote: >> Corrupted files may contain items with rec_size larger then g_record >> buffer and/or flt_data_size. >> >> Also g_record array size is now defined as constant. >> >> Signed-off-by: Jan Friesse <[email protected]> >> --- >> tools/corosync-fplay.c | 10 +++++++++- >> 1 files changed, 9 insertions(+), 1 deletions(-) >> >> diff --git a/tools/corosync-fplay.c b/tools/corosync-fplay.c >> index 2ecc06a..c5f778c 100644 >> --- a/tools/corosync-fplay.c >> +++ b/tools/corosync-fplay.c >> @@ -341,7 +341,9 @@ static struct printer_subsys printer_subsystems[] = { >> static unsigned int printer_subsys_count = >> sizeof (printer_subsystems) / sizeof (struct printer_subsys); >> >> -static unsigned int g_record[10000]; >> +#define G_RECORD_SIZE 10000 >> + >> +static unsigned int g_record[G_RECORD_SIZE]; >> >> /* >> * Copy record, dealing with wrapping >> @@ -354,6 +356,12 @@ static int logsys_rec_get (int rec_idx) { >> >> firstcopy = rec_size; >> secondcopy = 0; >> + >> + if (rec_size > G_RECORD_SIZE || rec_size > flt_data_size) { >> + fprintf (stderr, "rec_size too large. Input file is probably >> corrupted.\n"); >> + exit (EXIT_FAILURE); >> + } >> + > > As a matter of style/preference, I would have used sizeof(g_record) > instead of G_RECORD_SIZE here. (Feel free to tell my why my choice of > preference is a bad idea, though, if there is one. :-) ). > sizeof (g_record) = 40000
G_RECORD = 10000 Correct value is 10000 Doesn't much matter, as long as it is clear to the people reading. :) Regards -steve > -- > Russell Bryant > _______________________________________________ > Openais mailing list > [email protected] > https://lists.linux-foundation.org/mailman/listinfo/openais _______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
