add-assertions.patch 997 B

12345678910111213141516171819202122232425262728293031
  1. Description: Add assertion checks where appropriate
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Bug: https://bitbucket.org/ripencc/bgpdump/issues/37/
  4. Last-Update: 2016-07-23
  5. --- a/bgpdump_lib.c
  6. +++ b/bgpdump_lib.c
  7. @@ -184,6 +184,7 @@
  8. dump->parsed++;
  9. this_entry->attr=NULL;
  10. + assert(this_entry->length);
  11. buffer = malloc_check(this_entry->length);
  12. bytes_read = cfr_read_n(dump->f, buffer, this_entry->length);
  13. if(bytes_read != this_entry->length) {
  14. @@ -536,6 +537,7 @@
  15. e = &prefixdata->entries[i];
  16. mstream_getw(s, &e->peer_index);
  17. + assert (table_dump_v2_peer_index_table);
  18. e->peer = &table_dump_v2_peer_index_table->entries[e->peer_index];
  19. mstream_getl(s, &e->originated_time);
  20. @@ -574,6 +576,7 @@
  21. e = &prefixdata->entries[i];
  22. mstream_getw(s, &e->peer_index);
  23. + assert (table_dump_v2_peer_index_table);
  24. e->peer = &table_dump_v2_peer_index_table->entries[e->peer_index];
  25. mstream_getl(s, &e->originated_time);