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