cbuf to buf