* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
return tvb_get_ptr(member_tvb, member_offset, abs_length);
}
else {
- tvb->real_data = (guint8 *)g_malloc(abs_length);
- tvb_memcpy(tvb, (void *)tvb->real_data, 0, abs_length);
+ /* Use a temporary variable as tvb_memcpy is also checking tvb->real_data pointer */
+ void *real_data = g_malloc(tvb->length);
+ tvb_memcpy(tvb, real_data, 0, tvb->length);
+ tvb->real_data = (const guint8 *)real_data;
return tvb->real_data + abs_offset;
}
tvb_add_to_chain((tvbuff_t *)composite->tvbs->data, tvb); /* chain composite tvb to first member */
tvb->initialized = TRUE;
+ tvb->ds_tvb = tvb;
}
/*