libsysutils: Increase command buffersize and command args

Needed to support tethering of multiple remote Bluetooth devices.

Change-Id: I9f736affd83226e8b2fa4f0faacd3654175dd8c9
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
diff --git a/include/sysutils/FrameworkListener.h b/include/sysutils/FrameworkListener.h
index 756bacf..f1a4b43 100644
--- a/include/sysutils/FrameworkListener.h
+++ b/include/sysutils/FrameworkListener.h
@@ -23,10 +23,11 @@
 
 class FrameworkListener : public SocketListener {
 public:
-    static const int CMD_ARGS_MAX = 16;
+    static const int CMD_ARGS_MAX = 26;
 
     /* 1 out of errorRate will be dropped */
     int errorRate;
+
 private:
     int mCommandCount;
     bool mWithSeq;
diff --git a/libsysutils/src/FrameworkListener.cpp b/libsysutils/src/FrameworkListener.cpp
index 6731cf1..02a401d 100644
--- a/libsysutils/src/FrameworkListener.cpp
+++ b/libsysutils/src/FrameworkListener.cpp
@@ -25,6 +25,8 @@
 #include <sysutils/FrameworkCommand.h>
 #include <sysutils/SocketClient.h>
 
+static const int CMD_BUF_SIZE = 1024;
+
 FrameworkListener::FrameworkListener(const char *socketName, bool withSeq) :
                             SocketListener(socketName, true, withSeq) {
     init(socketName, withSeq);
@@ -43,7 +45,7 @@
 }
 
 bool FrameworkListener::onDataAvailable(SocketClient *c) {
-    char buffer[255];
+    char buffer[CMD_BUF_SIZE];
     int len;
 
     len = TEMP_FAILURE_RETRY(read(c->getSocket(), buffer, sizeof(buffer)));
@@ -52,6 +54,8 @@
         return false;
     } else if (!len)
         return false;
+   if(buffer[len-1] != '\0')
+        SLOGW("String is not zero-terminated");
 
     int offset = 0;
     int i;
@@ -63,6 +67,7 @@
             offset = i + 1;
         }
     }
+
     return true;
 }
 
@@ -74,7 +79,7 @@
     FrameworkCommandCollection::iterator i;
     int argc = 0;
     char *argv[FrameworkListener::CMD_ARGS_MAX];
-    char tmp[255];
+    char tmp[CMD_BUF_SIZE];
     char *p = data;
     char *q = tmp;
     char *qlimit = tmp + sizeof(tmp) - 1;
@@ -180,7 +185,6 @@
             goto out;
         }
     }
-
     cli->sendMsg(500, "Command not recognized", false);
 out:
     int j;