ring-buffer: Prevent overflow of size in ring_buffer_resize()