bool HexInStream::hexStrToBin(const char* s, char** data, int* length) {
  int l=strlen(s);
  if ((l % 2) == 0) {
    delete [] *data;
    *data = 0; *length = 0;
    if (l == 0)
      return true;
    *data = new char[l/2];
    *length = l/2;
    for(int i=0;i<l;i+=2) {
      int byte = 0;
      if (!readHexAndShift(s[i], &byte) ||
        !readHexAndShift(s[i+1], &byte))
        goto decodeError;
      (*data)[i/2] = byte;
    }
    return true;
  }
decodeError:
  delete [] *data;
  *data = 0;
  *length = 0;
  return false;
}
The software writes data past the end, or before the beginning, of the intended buffer.