From: Joel Holdsworth Date: Mon, 1 Apr 2013 07:46:02 +0000 (+0100) Subject: Padded data buffer so that reads do not overrun it. X-Git-Tag: pulseview-0.1.0~45 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=067e5d901290afe79f6991dab8f8042583779256;p=pulseview.git Padded data buffer so that reads do not overrun it. --- diff --git a/pv/data/snapshot.cpp b/pv/data/snapshot.cpp index afd1e43e..8571dc66 100644 --- a/pv/data/snapshot.cpp +++ b/pv/data/snapshot.cpp @@ -53,7 +53,8 @@ uint64_t Snapshot::get_sample_count() const void Snapshot::append_data(void *data, uint64_t samples) { lock_guard lock(_mutex); - _data = realloc(_data, (_sample_count + samples) * _unit_size); + _data = realloc(_data, (_sample_count + samples) * _unit_size + + sizeof(uint64_t)); memcpy((uint8_t*)_data + _sample_count * _unit_size, data, samples * _unit_size); _sample_count += samples;