You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
2.0 KiB

  1. From b1c29c35cba3eb39af18fb8db0ec676e3d658b1d Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke.mehrtens@intel.com>
  3. Date: Fri, 17 Jun 2016 17:38:35 +0200
  4. Subject: [PATCH] security: fix reading of permission attribute from
  5. configuration
  6. Casting the pointer to the permission attribute from uint16_t to uint64_t
  7. causes problems on MIPS Big Endian systems and probably othrs as well.
  8. When the calling method interprets it as uint64_t not the value is
  9. converted but the pointer is interpreted as it would point to a 64 bit
  10. integer, but it is only a 16 bit wide integer. On MIPS BE permission was
  11. always 0 independent of which value between 0 and 32 the permission
  12. attribute had, this was probably written to some padding area or into
  13. some other member of the struct.
  14. This patch fixes the memory corruption and makes the code work for me with
  15. a MIPS BE CPU.
  16. Change-Id: Ifa843e69980ad4309b1e3076b8e2c98c03324352
  17. Signed-off-by: Hauke Mehrtens <hauke.mehrtens@intel.com>
  18. ---
  19. resource/csdk/security/src/aclresource.c | 5 ++++-
  20. 1 file changed, 4 insertions(+), 1 deletion(-)
  21. --- a/resource/csdk/security/src/aclresource.c
  22. +++ b/resource/csdk/security/src/aclresource.c
  23. @@ -602,8 +602,11 @@ OicSecAcl_t* CBORPayloadToAcl(const uint
  24. // Permissions -- Mandatory
  25. if (strcmp(name, OIC_JSON_PERMISSION_NAME) == 0)
  26. {
  27. - cborFindResult = cbor_value_get_uint64(&aclMap, (uint64_t *) &acl->permission);
  28. + uint64_t tmp64;
  29. +
  30. + cborFindResult = cbor_value_get_uint64(&aclMap, &tmp64);
  31. VERIFY_CBOR_SUCCESS(TAG, cborFindResult, "Failed Finding a PERM Value.");
  32. + acl->permission = tmp64;
  33. }
  34. // Period -- Not mandatory