Realloc fail on union

I think I've confirmed this. You have:


  //DATA structure
  struct LongString
  {
    char* data;
    unsigned long capacity;
    unsigned long len;
  };

  struct ShortString
  {
    char data[SHORT_STRING_CAPACTY];
    byte len;
  };

So if you realloc() an existing short string, the pointer address you're passing in will be some random value consisting of the first few characters of the old shortstring, rather than a valid pointer or null. That ... won't be good.