Commit dd5ed50a authored by i.metelytsia's avatar i.metelytsia

FIX static analyzer issue

    - roleresource.c : sscanf function call has been replaced with strtol

Change-Id: I890548b946a8d27026a85ebd3bbad610d5b39a32
Signed-off-by: default avatari.metelytsia <i.metelytsia@samsung.com>
parent e5c1ce10
......@@ -30,6 +30,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <inttypes.h>
#include <errno.h>
#include "oic_string.h"
#include "cainterface.h"
#include "experimental/payload_logging.h"
......@@ -940,8 +941,10 @@ static OCEntityHandlerResult HandleDeleteRequest(OCEntityHandlerRequest *ehReque
if (strncasecmp((const char *)parseIter.attrPos, OIC_JSON_CREDID_NAME,
parseIter.attrLen) == 0)
{
int ret = sscanf((const char *)parseIter.valPos, "%u", &credId);
if (1 > ret)
char* endptr = NULL;
errno = 0;
credId = strtol((const char*)parseIter.valPos, &endptr, 10);
if (errno != 0 || !endptr || endptr == (char*)parseIter.valPos || *endptr != '\0')
{
OIC_LOG_V(ERROR, TAG, "credId was not valid: %s", parseIter.valPos);
ehRet = OC_EH_ERROR;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment