I get the above debugging problem from the function readString. I believe it has something to do with the way 'start' is defined in the function. The 0x07 in the array changes depending on the length of the following string. This string should say 'testing' in unicode.
int main(){
char readbuffer[] = {0x07, 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67};
char *buf = readbuffer;
uint32_t *stringread = (uint32_t *) malloc(sizeof(uint32_t));
*stringread = readString(buf);
}
uint32_t readString(char *buf)
{
uint32_t *start = (uint32_t *) malloc(sizeof(uint32_t));
int len;
len = protobuf_readVarint(buf, &buf);
memcpy (&start, buf, len);
buf += len;
return start;
}