fix sbuf bounds check