ACK

On 03/28/2013 10:39 AM, Jan Friesse wrote:
> For records in fdata smaller then 4 display error, because such record
> is invalid.
> 
> Signed-off-by: Jan Friesse <[email protected]>
> ---
>  tools/corosync-fplay.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/corosync-fplay.c b/tools/corosync-fplay.c
> index 96bb4f0..f07e225 100644
> --- a/tools/corosync-fplay.c
> +++ b/tools/corosync-fplay.c
> @@ -343,6 +343,11 @@ static unsigned int printer_subsys_count =
>  
>  #define G_RECORD_SIZE        10000
>  
> +/*
> + * Record must have at least 4 bytes - size, indent, line and record_number
> + */
> +#define MINIMUM_RECORD_SIZE  4
> +
>  static uint32_t g_record[G_RECORD_SIZE];
>  
>  /*
> @@ -362,6 +367,11 @@ static int logsys_rec_get (int rec_idx) {
>               exit (EXIT_FAILURE);
>       }
>  
> +     if (rec_size < MINIMUM_RECORD_SIZE) {
> +             fprintf (stderr, "rec_size too small. Input file is probably 
> corrupted.\n");
> +             exit (EXIT_FAILURE);
> +     }
> +
>       if (firstcopy + rec_idx > flt_data_size) {
>               firstcopy = flt_data_size - rec_idx;
>               secondcopy -= firstcopy - rec_size;
> 

_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss

Reply via email to