Skip to content

Commit

Permalink
Fix untrusted value used as argument
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
sysstat committed Oct 6, 2015
1 parent 4e4ecc3 commit 5dade14
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sadc.c
Expand Up @@ -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;
Expand Down

0 comments on commit 5dade14

Please sign in to comment.