From f6bc7833c6a07e2c945288a6cccfb64f76b2757c Mon Sep 17 00:00:00 2001 From: "hyuna0213.jo" Date: Mon, 14 Dec 2015 20:01:14 +0900 Subject: [PATCH] check the method type of request info. if method type of request info is invalid, CA has to return error code to RI Layer. Change-Id: Ic34da1c13e63172885a44a114a86f52cbbb34f6f Signed-off-by: hyuna0213.jo Reviewed-on: https://gerrit.iotivity.org/gerrit/4565 Tested-by: jenkins-iotivity Reviewed-by: MyeongGi Jeong Reviewed-by: Jon A. Cruz --- resource/csdk/connectivity/common/src/caremotehandler.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resource/csdk/connectivity/common/src/caremotehandler.c b/resource/csdk/connectivity/common/src/caremotehandler.c index a39b7d4..1315dae 100644 --- a/resource/csdk/connectivity/common/src/caremotehandler.c +++ b/resource/csdk/connectivity/common/src/caremotehandler.c @@ -55,6 +55,20 @@ CARequestInfo_t *CACloneRequestInfo(const CARequestInfo_t *rep) return NULL; } + // check the method type of request info. + // Keep this check in sync with CAMethod_t + switch (rep->method) + { + case CA_GET: + case CA_POST: + case CA_PUT: + case CA_DELETE: + break; + default: + OIC_LOG_V(ERROR, TAG, "Method %u is invalid", rep->method); + return NULL; + } + // allocate the request info structure. CARequestInfo_t *clone = (CARequestInfo_t *) OICMalloc(sizeof(CARequestInfo_t)); if (!clone) -- 2.7.4