From 1915ffd349387be3f2ce447ed21afbc0b90679f4 Mon Sep 17 00:00:00 2001 From: Omkar Hegde Date: Mon, 6 Oct 2014 09:40:00 -0700 Subject: [PATCH] 1. Added a check in ocstack.c for the Maximum JSON payload that can be sent. 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csdk/stack/src/ocstack.c b/csdk/stack/src/ocstack.c index ebaae39..4138c58 100644 --- a/csdk/stack/src/ocstack.c +++ b/csdk/stack/src/ocstack.c @@ -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) { -- 2.7.4