By making sure the buffer is initialized to a size that never can be filled..., make it automatically resize if it is close to full, or synchronize whatever reads the buffer with the function that fills it by using a que e.g....
A circular buffer is a good solution, you can have overflow in such a buffer as well, but then the consequence is only that you loose the data you did not read out before they got overwritten...
Circular buffer examples can be found on NI zone, here is one:
http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3ECB156A4E034080020E74861&p_node=DZ52026&p_submitted=N&p_rank=&p_answer=&p_source=External