rem: if (!decode_is_closing_tag_number(&apdu[len], 3))
add: if (!decode_is_closing_tag_number(&apdu[len], 2))
context: int awf_decode_service_request(  uint8_t *apdu,  unsigned apdu_len,  BACNET_WRITE_PROPERTY_DATA *data){  int len = 0;  int tag_len = 0;  uint8_t tag_number = 0;  uint32_t len_value_type = 0;  int type = 0; // for decoding  int property = 0; // for decoding  unsigned unsigned_value = 0;  int hour, min, sec, hundredths;  int year, month, day, wday;  int object_type = 0;  uint32_t instance = 0;  // check for value pointers  if (apdu_len && data)  {    // Tag 0: Object ID             if (!decode_is_context_tag(&apdu[len++], 0))      return -1;    len += decode_object_id(&apdu[len], &type, &data->object_instance);    data->object_type = type;    // Tag 1: Property ID    len += decode_tag_number_and_value(&apdu[len],        &tag_number, &len_value_type);    if (tag_number != 1)      return -1;    len += decode_enumerated(&apdu[len], len_value_type, &property);    data->object_property = property;    // Tag 2: Optional Array Index    // note: decode without incrementing len so we can check for opening tag    tag_len = decode_tag_number_and_value(&apdu[len],      &tag_number, &len_value_type);    if (tag_number == 2)    {      len += tag_len;      len += decode_unsigned(&apdu[len], len_value_type,        &unsigned_value);      data->array_index = unsigned_value;    }    else      data->array_index = BACNET_ARRAY_ALL;    // Tag 3: opening context tag */    if (!decode_is_opening_tag_number(&apdu[len], 3))      return -1;    // a tag number of 3 is not extended so only one octet    len++;    tag_len = decode_tag_number_and_value(&apdu[len],      &tag_number, &len_value_type);    if (tag_len)    {      len += tag_len;      if (tag_number == BACNET_APPLICATION_TAG_NULL)      {        data->value.tag = tag_number;      }      else if (tag_number == BACNET_APPLICATION_TAG_BOOLEAN)      {        data->value.tag = tag_number;        data->value.type.Boolean = decode_boolean(len_value_type);      }      else if (tag_number == BACNET_APPLICATION_TAG_UNSIGNED_INT)      {        data->value.tag = tag_number;        len += decode_unsigned(&apdu[len],          len_value_type,          &data->value.type.Unsigned_Int);      }      else if (tag_number == BACNET_APPLICATION_TAG_SIGNED_INT)      {         data->value.tag = tag_number;        len += decode_signed(&apdu[len],          len_value_type,          &data->value.type.Signed_Int);      }      else if (tag_number == BACNET_APPLICATION_TAG_REAL)      {        data->value.tag = tag_number;        len += decode_real(&apdu[len],&(data->value.type.Real));      }      else if (tag_number == BACNET_APPLICATION_TAG_ENUMERATED)      {        data->value.tag = tag_number;        len += decode_enumerated(&apdu[len],          len_value_type,          &data->value.type.Enumerated);      }      else if (tag_number == BACNET_APPLICATION_TAG_DATE)      {        data->value.tag = tag_number;        len += decode_date(&apdu[len], &year, &month, &day, &wday);        data->value.type.Date.year = year;        data->value.type.Date.month = month;        data->value.type.Date.day = day;        data->value.type.Date.wday = wday;      }      else if (tag_number == BACNET_APPLICATION_TAG_TIME)      {        data->value.tag = tag_number;        len += decode_bacnet_time(&apdu[len], &hour, &min, &sec, &hundredths);        data->value.type.Time.hour = hour;        data->value.type.Time.min = min;        data->value.type.Time.sec = sec;        data->value.type.Time.hundredths = hundredths;      }      else if (tag_number == BACNET_APPLICATION_TAG_OBJECT_ID)      {        data->value.tag = tag_number;        len += decode_object_id(&apdu[len],          &object_type,           &instance);        data->value.type.Object_ID.type = object_type;        data->value.type.Object_ID.instance = instance;      }      else        return -1;    }    else      return -1;    if (!decode_is_closing_tag_number(&apdu[len], 3))      return -1;    // a tag number of 3 is not extended so only one octet    len++;    // Tag 4: optional Priority    data->priority = BACNET_MAX_PRIORITIES;    if ((unsigned)len < apdu_len)    {      tag_len = decode_tag_number_and_value(&apdu[len],        &tag_number, &len_value_type);      if (tag_number == 4)      {        len += tag_len;        len = decode_unsigned(&apdu[len], len_value_type, &unsigned_value);        data->priority = unsigned_value;      }    }  }  return len;}