packages/net/iotivity/patches/050-csdk-move-OCEntityHandlerResponse-from-stack-to-heap.patch
Hauke Mehrtens 1e28dfe214 iotivity: update to version 1.2.1
This does the following changes:
* update to version 1.2.1
* add iotivity-resource-directory-lib, this is needed by most
  applications now
* do not activate security support by default, this caused some
  problems and needs some more settings to setup.
* use sqlite version from normal package feed instead of using an own
  version
* build against LEDE version of mbedtls
* update example security configuration
* remove some patches that went upstream
* add some new patches fixing problems observed in my environment, most
  of them are on their way upstream.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2017-01-09 23:31:22 +01:00

54 lines
2.1 KiB
Diff

From d8cf30cb0abd5fa8f6282b490618204d683b625c Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 3 Oct 2016 21:00:28 +0200
Subject: [PATCH 1/3] csdk: move OCEntityHandlerResponse from stack to heap
OCEntityHandlerResponse is over 50KByte and I got a stack overflow on MIPS
running on LEDE without this patch. Instead of storing
OCEntityHandlerResponse on the program stack, allocate some memory on
the heap and free it afterwards again.
This fixes one part of this issue for me:
https://jira.iotivity.org/browse/IOT-1374
Change-Id: I365a5c7a34dce2dfb0897a20b57a13ba566748ec
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
resource/csdk/stack/src/ocresource.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
--- a/resource/csdk/stack/src/ocresource.c
+++ b/resource/csdk/stack/src/ocresource.c
@@ -774,15 +774,25 @@ static bool includeThisResourceInRespons
OCStackResult SendNonPersistantDiscoveryResponse(OCServerRequest *request, OCResource *resource,
OCPayload *discoveryPayload, OCEntityHandlerResult ehResult)
{
- OCEntityHandlerResponse response = {0};
+ OCEntityHandlerResponse *response = NULL;
+ OCStackResult result = OC_STACK_ERROR;
- response.ehResult = ehResult;
- response.payload = discoveryPayload;
- response.persistentBufferFlag = 0;
- response.requestHandle = (OCRequestHandle) request->requestId;
- response.resourceHandle = (OCResourceHandle) resource;
+ response = (OCEntityHandlerResponse *)OICCalloc(1, sizeof(*response));
+ VERIFY_PARAM_NON_NULL(TAG, response, "Failed allocating OCEntityHandlerResponse");
- return OCDoResponse(&response);
+ response->ehResult = ehResult;
+ response->payload = discoveryPayload;
+ response->persistentBufferFlag = 0;
+ response->requestHandle = (OCRequestHandle) request->requestId;
+ response->resourceHandle = (OCResourceHandle) resource;
+
+ result = OCDoResponse(response);
+
+ OICFree(response);
+ return result;
+
+exit:
+ return OC_STACK_NO_MEMORY;
}
static OCStackResult EHRequest(OCEntityHandlerRequest *ehRequest, OCPayloadType type,