]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
moncaps: fix array out of bounds in parsing
authorSage Weil <sage@newdream.net>
Sun, 12 Sep 2010 16:18:13 +0000 (09:18 -0700)
committerSage Weil <sage@newdream.net>
Sun, 12 Sep 2010 16:18:13 +0000 (09:18 -0700)
src/mon/MonCaps.cc

index 9460595251f0ef00792080f0e2c72eb29a210471..13728f3578dd475ba2e8a3cab4ab5e51eac57d1d 100644 (file)
@@ -8,16 +8,16 @@ bool MonCaps::get_next_token(string s, size_t& pos, string& token)
   int start = s.find_first_not_of(" \t", pos);
   int end;
 
+  if (start < 0) {
+    return false; 
+  }
+
   if (s[start] == '=' || s[start] == ',' || s[start] == ';') {
     end = start + 1;
   } else {
     end = s.find_first_of(";,= \t", start+1);
   }
 
-  if (start < 0) {
-    return false; 
-  }
-
   if (end < 0) {
     end=s.size();
   }