forked from osmocom/wireshark
Clamp down on address data structure usage and AT_NONE semantics
Catch errors like bug 12205 with an assertion. Change-Id: I17381c92dfb22912e53eb20f6436adfa15d67e71 Reviewed-on: https://code.wireshark.org/review/14251 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
This commit is contained in:
parent
0ebb4912f9
commit
ca744729a4
|
@ -133,16 +133,16 @@ set_address_tvb(address *addr, int addr_type, int addr_len, tvbuff_t *tvb, int o
|
|||
static inline void
|
||||
alloc_address_wmem(wmem_allocator_t *scope, address *addr,
|
||||
int addr_type, int addr_len, const void *addr_data) {
|
||||
if (addr == NULL)
|
||||
return;
|
||||
g_assert(addr);
|
||||
clear_address(addr);
|
||||
addr->type = addr_type;
|
||||
addr->len = addr_len;
|
||||
if (addr_type == AT_NONE || addr->len <= 0) {
|
||||
addr->data = addr->priv = NULL;
|
||||
if (addr_type == AT_NONE || addr_len <= 0 || addr_data == NULL) {
|
||||
g_assert(addr_len <= 0);
|
||||
g_assert(addr_data == NULL);
|
||||
return;
|
||||
}
|
||||
addr->priv = wmem_memdup(scope, addr_data, addr->len);
|
||||
addr->data = addr->priv;
|
||||
addr->data = addr->priv = wmem_memdup(scope, addr_data, addr_len);
|
||||
addr->len = addr_len;
|
||||
}
|
||||
|
||||
/** Allocate an address from TVB data.
|
||||
|
|
Loading…
Reference in New Issue