1
0

catch-overlong-filename.patch 611 B

123456789101112131415161718
  1. Description: Catch file names that exceed the buffer limit
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Bug: https://bitbucket.org/ripencc/bgpdump/issues/29/
  4. Last-Update: 2014-05-28
  5. --- a/bgpdump_lib.c
  6. +++ b/bgpdump_lib.c
  7. @@ -97,6 +97,10 @@
  8. BGPDUMP *this_dump = malloc(sizeof(BGPDUMP));
  9. strcpy(this_dump->filename, "[STDIN]");
  10. if(filename && strcmp(filename, "-")) {
  11. + if (strlen(filename) >= BGPDUMP_MAX_FILE_LEN - 1) {
  12. + fprintf (stderr, "File name %s is too long.\n", filename);
  13. + exit(1);
  14. + }
  15. strcpy(this_dump->filename, filename);
  16. }