assert(buf != NULL) ?