Error Report from Klocwork
1)FUNCRET.GEN: Non-void function does not return value :
C and C++ : gen_sec_bin.cpp : Critical (1) : Analyze : Local
2)NPD.CHECK.MIGHT: Pointer 'fps' checked for NULL at line 123
may be dereferenced at line 132. : C and C++ : gen_sec_bin.cpp :
Critical (1) : Analyze : Local
3)NPD.FUNC.MIGHT: Pointer 'fps' returned from call to function 'fopen'
at line 123 may be NULL and may be dereferenced at line 132. :
C and C++ : gen_sec_bin.cpp : Critical (1) : Analyze : Local
4)UNINIT.STACK.ARRAY.MIGHT: 'payload' array elements might be used
uninitialized in this function. : C and C++ : ocserverbasicops.cpp :
Critical (1) : Analyze : Local
Change-Id: I970bc060191caf17b102b165bbe5656b079ad063
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/374
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Joseph Morrow <joseph.l.morrow@intel.com>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
if ((fpc = (FILE*) fopen("client_cred.bin", "wb")) != NULL)
{
- fwrite(oscd_c, SizeOfOCConfigData(oscd_c), 1, fps);
+ fwrite(oscd_c, SizeOfOCConfigData(oscd_c), 1, fpc);
fclose(fpc);
}
printStruct("Server", (OCSecConfigData*)buf_s);
printStruct("Client", (OCSecConfigData*)buf_c);
+ return 1;
}
OCEntityHandlerResult ehResult = OC_EH_ERROR;
OCEntityHandlerResponse response;
- char payload[MAX_RESPONSE_LENGTH];
+ char payload[MAX_RESPONSE_LENGTH] = {0};
if (flag & OC_INIT_FLAG)
{
{
OC_LOG_V (INFO, TAG, "Received unsupported method %d from client",
entityHandlerRequest->method);
+ ehResult = OC_EH_ERROR;
}
if (ehResult == OC_EH_OK)