]> granicus.if.org Git - sysstat/commit
sar: Fortify remap_struct() function
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 25 Aug 2018 13:53:39 +0000 (15:53 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 25 Aug 2018 13:53:39 +0000 (15:53 +0200)
commitcb7f009e41341c687c449dd37b9c528c4878455a
treeea5e19e2244e4ea80fc8a5613dc6a8cb365e08e0
parent9d8e94bfd1e48dd5bb1eece7978b7a0b86e76127
sar: Fortify remap_struct() function

New metrics can be added to sar with new sysstat versions. These new
metrics correspond to new fields added to existing statistics
structures.
For compatibility reasons, sysstat assumes that these structures
(identified by their number of fields of different types: long long,
long and int) can only grow with newer sysstat versions. Yet commit c2f9d16
has fixed a longstanding bug regarding a wrong size used for structure
stats_huge. With this bugfix structure stats_huge has now a size smaller
than before. We need to update remap_struct() function to deal with
this. Else adding new fields to structure stats_huge will make sar
unable to read older binary datafiles and crash:

free(): invalid pointer
Aborted (core dumped)

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
sa_common.c