Buffer size must be positive
Emptied buffer into local variable for thread safety