boatbod / op25

Fork of osmocom OP25 by boatbod
311 stars 97 forks source link

use iterators for std::fill, fix out of bounds access #173

Closed Jannik2099 closed 1 year ago

Jannik2099 commented 1 year ago

See also robotastic/trunk-recorder#782

Even though you are only using the address of the vector[0], you were still dereferencing it first via operator[], which is UB if the index does not exist. Using iterators fixes this as vector.begin() returns vector.end() if vector.size() is 0.

CC @ZeroChaos-