@cryptotaxi247 / netdata-1 / commits / 3e0661a2a

Fix buffer overflow in rrdr structure when metric timestamps are out of order. (#9903)

Markos Fountoulakis committed Sep 9, 2020 at 17:03 UTC 3e0661a2afebbe3b40e51740abe468de23e11e41
1 file changed +6
web/api/queries/query.c
+6
@@ -573,6 +573,12 @@ static inline void do_dimension_fixedstep(
573 #endif
574 db_now = now; // this is needed to set db_now in case the next_metric implementation does not set it
575 storage_number n = rd->state->query_ops.next_metric(&handle, &db_now);
576 + if(unlikely(db_now > before_wanted)) {
577 +#ifdef NETDATA_INTERNAL_CHECKS
578 + r->internal.log = "stopped, because attempted to access the db after 'wanted before'";
579 +#endif
580 + break;
581 + }
582 for ( ; now <= db_now ; now += dt) {
583 calculated_number value = NAN;
584 if(likely(now >= db_now && does_storage_number_exist(n))) {