1234567891011121314151617181920212223242526272829303132 |
- Description: Handle prefix lists with more than MAX_PREFIXES prefixes gracefully
- Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
- 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
- @@ -1525,11 +1525,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);
- }
|