[ovs-dev] [PATCH] ovs-ofctl: Fix write before beginning of string in "add-flow".

Ben Pfaff blp at nicira.com
Tue Apr 13 17:30:37 UTC 2010


If "action" is the first word in a flow specification, then we were writing
one byte before the beginning of the string.  So overwrite the 'a' in
"action" instead; we know it's really there.

Reported-by: Ghanem Bahri <bahri.ghanem at gmail.com>
---
 utilities/ovs-ofctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 360f881..204e958 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -780,9 +780,9 @@ str_to_flow(char *string, struct ofp_match *match, struct ofpbuf *actions,
         if (!act_str) {
             ovs_fatal(0, "must specify an action");
         }
-        *(act_str-1) = '\0';
+        *act_str = '\0';
 
-        act_str = strchr(act_str, '=');
+        act_str = strchr(act_str + 1, '=');
         if (!act_str) {
             ovs_fatal(0, "must specify an action");
         }
-- 
1.6.6.1





More information about the dev mailing list