1. Added a check in ocstack.c for the Maximum JSON payload that can be sent.
authorOmkar Hegde <omkar.m.hegde@intel.com>
Mon, 6 Oct 2014 16:40:00 +0000 (09:40 -0700)
committerErich Keane <erich.keane@intel.com>
Wed, 8 Oct 2014 17:28:45 +0000 (10:28 -0700)
2. Added specific error message to result. Changes in if() as suggested.
4. Replaced tab with spaces and moved the check before any processing begins.
Change-Id: Id06ce2f7deaf643acd4f3cf4fcdd9ce30e2eddbc

csdk/stack/src/ocstack.c

index ebaae39..4138c58 100644 (file)
@@ -415,6 +415,12 @@ OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requ
         goto exit;
     }
 
+    if((request) && (strlen(request) > MAX_REQUEST_LENGTH))
+    {
+        result = OC_STACK_INVALID_PARAM;
+        goto exit;
+    }
+
     requestUri = (unsigned char *) OCMalloc(uriLen + 1);
     if(requestUri)
     {