The length of a data array corresponds to the nmemb parameter, not sz.