fix: should calculate buffer-size based on type of size_t.