Can you give an example code that crashes? fread should not crash if you try to read too much data. See an example below. Note that the return value of fread is the actual number of objects read.
chulbert@maclap ~$ cat junk.c
#include
#include
int main(void)
{
FILE *fp;
size_t n1,n2;
unsigned char buf[100];
fp = fopen("junk","rb");
n1 =...