2
1

0002-libteeacl-use-realloc-instead-of-reallocarray.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. From dde6306458331371be5df15e3ca953697d2463ef Mon Sep 17 00:00:00 2001
  2. From: Eero Aaltonen <eero.aaltonen@vaisala.com>
  3. Date: Thu, 2 Feb 2023 17:22:29 +0200
  4. Subject: [PATCH] libteeacl: use realloc() instead of reallocarray()
  5. Use realloc() instead of reallocarray(), since uClibc apparently does
  6. not implement reallocarray().
  7. Fixes: https://github.com/OP-TEE/optee_client/issues/339
  8. Signed-off-by: Eero Aaltonen <eero.aaltonen@vaisala.com>
  9. Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
  10. [Retrieved from:
  11. https://github.com/OP-TEE/optee_client/commit/dde6306458331371be5df15e3ca953697d2463ef]
  12. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  13. ---
  14. libteeacl/src/group.c | 3 ++-
  15. 1 file changed, 2 insertions(+), 1 deletion(-)
  16. diff --git a/libteeacl/src/group.c b/libteeacl/src/group.c
  17. index 10965dd0..bd165a11 100644
  18. --- a/libteeacl/src/group.c
  19. +++ b/libteeacl/src/group.c
  20. @@ -72,7 +72,8 @@ enum rv_groupmember teeacl_user_is_member_of(const char *user, gid_t group)
  21. if (ret == -1) {
  22. p_groups = groups;
  23. - groups = reallocarray(groups, grouplistsize, sizeof(gid_t));
  24. + /* we use realloc, since uClibc does not implement reallocarray */
  25. + groups = realloc(groups, grouplistsize * sizeof(gid_t));
  26. if (!groups) {
  27. free(p_groups);
  28. return E_MEMORY;