Description: Catch file names that exceed the buffer limit Author: Christoph Biedl Bug: https://bitbucket.org/ripencc/bgpdump/issues/29/ Last-Update: 2014-05-28 --- a/bgpdump_lib.c +++ b/bgpdump_lib.c @@ -97,6 +97,10 @@ BGPDUMP *this_dump = malloc(sizeof(BGPDUMP)); strcpy(this_dump->filename, "[STDIN]"); if(filename && strcmp(filename, "-")) { + if (strlen(filename) >= BGPDUMP_MAX_FILE_LEN - 1) { + fprintf (stderr, "File name %s is too long.\n", filename); + exit(1); + } strcpy(this_dump->filename, filename); }