Package: softflowd / 0.9.9-5

cherry-pick.softflowd-0.9.9-16-gbbd0685.add-check-of-the-length-of-string-for-i-interface-option.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;