If parser data contains entries with timestamp in future, they should
be discarded. If such entries are allowed to be put into the rrd
database, the database will refuse to accept any more any entries,
untill current date is again above the corrupted date. Depending on
the severity of the corruption, this might prevent any further updates
to the database.
Therefore it is better to not allow any updates from future.
Signed-off-by: Timo Kokkonen <timo.t.kokkonen@iki.fi>
(char *const)rrd->filename,
};
int old_last_update = rrd->last_update;
(char *const)rrd->filename,
};
int old_last_update = rrd->last_update;
+ time_t now = time(NULL);
ret = rrd->parser->parse_multi(&data, rrd->parser_data,
&rrd->parser_state, rrd->last_update);
ret = rrd->parser->parse_multi(&data, rrd->parser_data,
&rrd->parser_state, rrd->last_update);
- for (i = 3, d = 0; i < ARRAY_SIZE(cmdline) - 1; i++, d++) {
+ for (i = 3, d = 0; i < ARRAY_SIZE(cmdline) - 1; d++) {
time_t then;
if (!data[d])
time_t then;
if (!data[d])
sanitize_rrd_update_data(data[d]);
then = atoi(data[d]);
sanitize_rrd_update_data(data[d]);
then = atoi(data[d]);
+ if (then > now) {
+ pr_err("Skipping bad data with timestamp in future: %ld > %ld\n",
+ then, now);
+ continue;
+ }
write_to_logfile(rrd, data[d], then);
cmdline[i] = data[d];
pr_info("Data: %s\n", data[d]);
rrd->last_update = then;
write_to_logfile(rrd, data[d], then);
cmdline[i] = data[d];
pr_info("Data: %s\n", data[d]);
rrd->last_update = then;