Fixed bug in compared WILDCARD_SUBJECT_ID
authorjs126.lee <js126.lee@samsung.com>
Tue, 21 Mar 2017 06:43:06 +0000 (15:43 +0900)
committerNathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
Wed, 22 Mar 2017 04:26:13 +0000 (04:26 +0000)
Issue : If the first character of deviceuuid generated ramdomly is *(2a) in PT,
        subjectuuid of cred is set to * wrongly instead of actual deviceuuid
        during generating cred payload during OT.

Change-Id: Idc6587d71456a1eb7a816bd083bfcbb5c94e9c34
Signed-off-by: js126.lee <js126.lee@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/18041
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Nathan Heldt-Sheller <nathan.heldt-sheller@intel.com>
resource/csdk/security/src/credresource.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 81a4c42..28c2db8
@@ -673,7 +673,7 @@ OCStackResult CredToCBORPayload(const OicSecCred_t *credS, uint8_t **cborPayload
         cborEncoderResult = cbor_encode_text_string(&credMap, OIC_JSON_SUBJECTID_NAME,
             strlen(OIC_JSON_SUBJECTID_NAME));
         VERIFY_CBOR_SUCCESS(TAG, cborEncoderResult, "Failed Adding Subject Tag.");
-        inLen = (memcmp(&(cred->subject), &WILDCARD_SUBJECT_ID, WILDCARD_SUBJECT_ID_LEN) == 0) ?
+        inLen = (memcmp(&(cred->subject), &WILDCARD_SUBJECT_ID, sizeof(OicUuid_t)) == 0) ?
             WILDCARD_SUBJECT_ID_LEN : sizeof(OicUuid_t);
         if(inLen == WILDCARD_SUBJECT_ID_LEN)
         {