Perhaps the buf can be defined as static?