Fix serious bug - pointer arithmetic on void *
Now p is a unsigned char *