Description: Handle prefix lists with more than MAX_PREFIXES prefixes gracefully Author: Christoph Biedl Bug: https://bitbucket.org/ripencc/bgpdump/issue/2/ Bug: https://bitbucket.org/ripencc/bgpdump/issue/10/ Bug: https://bitbucket.org/ripencc/bgpdump/issue/13/ Bug: https://bitbucket.org/ripencc/bgpdump/issue/17/ Bug: https://bitbucket.org/ripencc/bgpdump/issue/18/ Last-Update: 2016-07-13 --- a/bgpdump_lib.c +++ b/bgpdump_lib.c @@ -1590,11 +1590,16 @@ break; } - struct prefix *prefix = prefixes + count; + struct prefix *prefix; - if(count++ > MAX_PREFIXES) - continue; - + if(count < MAX_PREFIXES) { + prefix = prefixes + count; + } else { + /* read and discard */ + static struct prefix void_prefix; + prefix = &void_prefix; + } + count++; *prefix = (struct prefix) { .len = p_len, .path_id = path_id }; mstream_get(s, &prefix->address, p_bytes); }