Make size and buf check for null.