1
0

cherry-pick.softflowd-0.9.9-16-gbbd0685.add-check-of-the-length-of-string-for-i-interface-option.patch 774 B

12345678910111213141516171819202122232425
  1. Subject: Add check of the length of string for -i (interface) option
  2. Origin: softflowd-0.9.9-16-gbbd0685 <https://github.com/irino/softflowd/commit/softflowd-0.9.9-16-gbbd0685>
  3. Upstream-Author: Hitoshi Irino <irino@sfc.wide.ad.jp>
  4. Date: Fri Sep 14 18:32:33 2018 +0900
  5. --- a/softflowd.c
  6. +++ b/softflowd.c
  7. @@ -1834,9 +1834,16 @@
  8. dev = strtok(optarg, ":");
  9. #endif /* defined(HAVE_STRSEP) */
  10. if (optarg != NULL) {
  11. - if_index = (u_int16_t) atoi(dev);
  12. + if (strlen(dev) > 0) {
  13. + if_index = (u_int16_t) atoi(dev);
  14. + }
  15. dev = optarg;
  16. }
  17. + if (strlen(dev) == 0) {
  18. + fprintf(stderr, "Wrong interface is specified.\n\n");
  19. + usage();
  20. + exit(1);
  21. + }
  22. if (verbose_flag)
  23. fprintf(stderr, "Using %s (idx: %d)\n", dev, if_index);
  24. break;