From: Sebastien GODARD Date: Tue, 6 Oct 2015 14:58:01 +0000 (+0200) Subject: Fix untrusted value used as argument X-Git-Tag: v11.1.8~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5dade14d04cae325a1ed1af538753cae63081659;p=sysstat Fix untrusted value used as argument sa_vol_act_nr is read from an untrusted source and used as a loop boundary. Check it before using it. CID #29720. Signed-off-by: Sebastien GODARD --- diff --git a/sadc.c b/sadc.c index 31fa9ed..da4c9fb 100644 --- a/sadc.c +++ b/sadc.c @@ -896,9 +896,11 @@ void open_ofile(int *ofd, char ofile[], int restart_mark) } /* OK: It's a true system activity file */ - if (!file_hdr.sa_act_nr || (file_hdr.sa_act_nr > NR_ACT)) + if (!file_hdr.sa_act_nr || (file_hdr.sa_act_nr > NR_ACT) || + (file_hdr.sa_vol_act_nr > NR_ACT)) /* - * No activities at all or at least one unknown activity: + * No activities at all or at least one unknown activity, + * or too many volatile activities: * Cannot append data to such a file. */ goto append_error;