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 <sysstat@users.noreply.github.com>
}
/* 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;