Description: Add assertion checks where appropriate Author: Christoph Biedl Bug: https://bitbucket.org/ripencc/bgpdump/issues/37/ Last-Update: 2016-07-23 --- a/bgpdump_lib.c +++ b/bgpdump_lib.c @@ -184,6 +184,7 @@ dump->parsed++; this_entry->attr=NULL; + assert(this_entry->length); buffer = malloc_check(this_entry->length); bytes_read = cfr_read_n(dump->f, buffer, this_entry->length); if(bytes_read != this_entry->length) { @@ -536,6 +537,7 @@ e = &prefixdata->entries[i]; mstream_getw(s, &e->peer_index); + assert (table_dump_v2_peer_index_table); e->peer = &table_dump_v2_peer_index_table->entries[e->peer_index]; mstream_getl(s, &e->originated_time); @@ -574,6 +576,7 @@ e = &prefixdata->entries[i]; mstream_getw(s, &e->peer_index); + assert (table_dump_v2_peer_index_table); e->peer = &table_dump_v2_peer_index_table->entries[e->peer_index]; mstream_getl(s, &e->originated_time);