/* If anything is wrong, return -1, since -1 is not a valid string length. Else, return the number of chars processed.  */
static guint16 proto_add_icq_attr(proto_tree *tree, tvbuff_t *tvb, const int offset, const int *hf)
/* If anything is wrong, return -1, since -1 is not a valid string length. Else, return the number of chars processed.  */
static guint16 proto_add_icq_attr(proto_tree *tree, tvbuff_t *tvb, const int offset, const int *hf)
{
    guint16 len;
    len = tvb_get_letohs(tvb, offset);
    if (len > tvb_reported_length_remaining(tvb, offset))
        return -1;
    proto_tree_add_string(tree, *hf, tvb, offset, len+2,
            tvb_get_string_enc(wmem_packet_scope(), tvb, offset + 2, len, ENC_ASCII));
    return len + 2;
}