add: soap->arraySize[sizeof(soap->arrayType)-1] = '\0'; soap->arrayType[sizeof(soap->arrayType)-1] = '\0';
context: soap_peek_element(struct soap *soap){ struct soap_attribute *tp;  const char *t;  register char *s;  register wchar c;  register int i;  if (soap->peeked)  { if (*soap->tag == '\0')      return soap->error = SOAP_NO_TAG;    return SOAP_OK;  }  soap->peeked = 1;  for (;;)  { while (((c = soap_get(soap)) != LT) && c != TT)    { if ((int)c == EOF)        return soap->error = SOAP_EOF;    }    if (c == TT)    { *soap->tag = '\0';      return soap->error = SOAP_NO_TAG; /* ending tag found */    }    s = soap->tag;    do c = soap_get(soap);    while (soap_blank(c));    i = sizeof(soap->tag);    while (c != '/' && soap_notblank(c))    { if (--i > 0)        *s++ = (char)c;      c = soap_get(soap);    }    while (soap_blank(c))      c = soap_get(soap);    *s = '\0';    if (*soap->tag != '?')      break;    DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <%s?>\n", soap->tag));    while ((int)c != EOF && c != GT && c != '?')    { s = soap->tmpbuf;      i = sizeof(soap->tmpbuf) - 2;      while (c != '=' && c != GT && c != '?' && soap_notblank(c))      { if (--i > 0)          *s++ = (char)c;        c = soap_get(soap);      }      while (soap_blank(c))        c = soap_get(soap);      if (c == '=')      { *s++ = '=';	do c = soap_get(soap);        while (soap_blank(c));        if (c != QT && c != AP)        { soap_unget(soap, c);          c = ' '; /* blank delimiter */        }        if (soap_getattrval(soap, s, i, c) == SOAP_EOM)	  while (soap_getattrval(soap, soap->tmpbuf, sizeof(soap->tmpbuf), c) == SOAP_EOM)	    ;        else if (!strcmp(soap->tag, "?xml") && (!soap_tag_cmp(soap->tmpbuf, "encoding=iso-8859-1") || !soap_tag_cmp(soap->tmpbuf, "encoding=latin1")))        { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML latin1 encoding\n"));          soap->mode |= SOAP_C_LATIN;        }      }      do c = soap_get(soap);      while (soap_blank(c));    }  }  soap->id[0] = '\0';  soap->href[0] = '\0';  soap->type[0] = '\0';  soap->arrayType[0] = '\0';  soap->arraySize[0] = '\0';  soap->arrayOffset[0] = '\0';  soap->other = 0;  soap->root = -1;  soap->position = 0;  soap->null = 0;  soap->mustUnderstand = 0;  soap_clr_attr(soap);  soap_pop_namespace(soap);  while ((int)c != EOF && c != GT && c != '/')  { s = soap->tmpbuf;    i = sizeof(soap->tmpbuf);    while (c != '=' && c != '/' && soap_notblank(c))    { if (--i > 0)        *s++ = (char)c;      c = soap_get(soap);    }    *s = '\0';    if (i == sizeof(soap->tmpbuf))      return soap->error = SOAP_SYNTAX_ERROR;    if (!strncmp(soap->tmpbuf, "xmlns:", 6))    { soap->tmpbuf[5] = '\0';      t = soap->tmpbuf + 6;    }    else if (!strcmp(soap->tmpbuf, "xmlns"))      t = SOAP_STR_EOS;    else      t = NULL;    tp = soap_attr(soap, soap->tmpbuf);    if (!tp)    { tp = (struct soap_attribute*)SOAP_MALLOC(sizeof(struct soap_attribute) + strlen(soap->tmpbuf));      if (!tp)        return soap->error = SOAP_EOM;      strcpy(tp->name, soap->tmpbuf);      tp->value = NULL;      tp->size = 0;      tp->next = soap->attributes;      soap->attributes = tp;    }    while (soap_blank(c))      c = soap_get(soap);    if (c == '=')    { do c = soap_get(soap);      while (soap_blank(c));      if (c != QT && c != AP)      { soap_unget(soap, c);        c = ' '; /* blank delimiter */      }      if (soap_getattrval(soap, tp->value, tp->size, c))      {#ifdef WITH_FAST        if (soap->error != SOAP_EOM)          return soap->error;        soap->error = SOAP_OK;	soap->labidx = 0;	if (soap_append_lab(soap, tp->value, tp->size))	  return soap->error;	SOAP_FREE(tp->value);	for (;;)	{ if (soap_getattrval(soap, soap->labbuf + soap->labidx, soap->lablen - soap->labidx, c))	  { if (soap->error != SOAP_EOM)	      return soap->error;            soap->error = SOAP_OK;	    soap->labidx = soap->lablen;	    if (soap_append_lab(soap, NULL, 0))	      return soap->error;	  }	  else	    break;	}        tp->size = soap->lablen;	if (!(tp->value = (char*)SOAP_MALLOC(tp->size)))	  return soap->error = SOAP_EOM;        memcpy(tp->value, soap->labbuf, soap->lablen);#else	size_t n;        if (soap->error != SOAP_EOM)          return soap->error;        soap->error = SOAP_OK;        if (soap_new_block(soap))          return soap->error;        for (;;)        { if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN)))            return soap->error;          if (soap_getattrval(soap, s, SOAP_BLKLEN, c))          { if (soap->error != SOAP_EOM)              return soap->error;            soap->error = SOAP_OK;          }          else            break;        }	n = tp->size + soap->blist->size;        if (!(s = (char*)SOAP_MALLOC(n)))          return soap->error = SOAP_EOM;        if (tp->value)        { memcpy(s, tp->value, tp->size);          SOAP_FREE(tp->value);        }        soap_save_block(soap, s + tp->size);        tp->value = s;        tp->size = n;#endif      }      do c = soap_get(soap);      while (soap_blank(c));      tp->visible = 2; /* seen this attribute w/ value */    }    else      tp->visible = 1; /* seen this attribute w/o value */    if (t && tp->value)    { if (soap_push_namespace(soap, t, tp->value))        return soap->error;      tp->visible = 0;    }  }  if ((int)c == EOF)    return soap->error = SOAP_EOF;  for (tp = soap->attributes; tp; tp = tp->next)  { if (tp->visible && tp->value)    { if (!strcmp(tp->name, "id"))      { if (soap->part != SOAP_IN_HEADER || !soap->dot_net_bug)        { *soap->id = '#';          strncpy(soap->id + 1, tp->value, sizeof(soap->id) - 2);        }      }      else if (soap->version == 1 && !strcmp(tp->name, "href"))        strncpy(soap->href, tp->value, sizeof(soap->href) - 1);      else if (soap->version == 2 && !strcmp(tp->name, "ref"))      { *soap->href = '#';        strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2);      }      else if (!soap_match_tag(soap, tp->name, "xsi:type"))        strncpy(soap->type, tp->value, sizeof(soap->type) - 1);      else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arrayType"))      { s = soap_strrchr(tp->value, '[');        if (s && (size_t)(s - tp->value) < sizeof(soap->arrayType))        { strncpy(soap->arrayType, tp->value, s - tp->value);          soap->arrayType[s - tp->value] = '\0';          strncpy(soap->arraySize, s, sizeof(soap->arraySize) - 1);        }        else          strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1);      }      else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType"))        strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1);      else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize"))        strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1);      else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset"))        strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset));      else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position"))        soap->position = soap_getposition(tp->value, soap->positions);      else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:root"))        soap->root = ((!strcmp(tp->value, "1") || !strcmp(tp->value, "true")));      else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:actor")            || !soap_match_tag(soap, tp->name, "SOAP-ENV:role"))      { if ((!soap->actor || strcmp(soap->actor, tp->value))         && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next")         && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next"))          soap->other = 1;      }      else if (!soap_match_tag(soap, tp->name, "SOAP-ENV:mustUnderstand")            && (!strcmp(tp->value, "1") || !strcmp(tp->value, "true")))        soap->mustUnderstand = 1;      else if ((!soap_match_tag(soap, tp->name, "xsi:null")             || !soap_match_tag(soap, tp->name, "xsi:nil"))            && (!strcmp(tp->value, "1")             || !strcmp(tp->value, "true")))        soap->null = 1;    }  }  if (!(soap->body = (c != '/')))    do c = soap_get(soap);    while (soap_blank(c));  return SOAP_OK;}