Function should be static. I suggest you move buf into the function body.