Hello Thien,
Ack.
Regards, Thanh

-----Original Message-----
From: thien.m.huynh <thien.m.hu...@dektech.com.au> 
Sent: Tuesday, 8 February 2022 7:59 PM
To: Minh Hon Chau <minh.c...@dektech.com.au>; Thang Duc Nguyen 
<thang.d.ngu...@dektech.com.au>; Hieu Hong Hoang <hieu.h.ho...@dektech.com.au>
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1/1] imm: fix immnd crash when authenticate non-local 
user [#3305]

Correct length of buffer and init memory when allocate memory
---
 src/base/osaf_secutil.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/base/osaf_secutil.c b/src/base/osaf_secutil.c index 
3d3e32fbd..3a90b0f1c 100644
--- a/src/base/osaf_secutil.c
+++ b/src/base/osaf_secutil.c
@@ -225,8 +225,8 @@ static char *get_supplementary_group_list(pid_t pid)
                // Exclude 'Groups:' string and a following tab
                size_t len = strlen(line_buf) - groups_len - 1;
                assert(len && "Invalid sumplementary group list");
-               group_list = (char *)malloc(len);
-               strcpy(group_list, line_buf + groups_len + 1);
+               group_list = (char *)calloc(len, sizeof(char));
+               memcpy(group_list, line_buf + groups_len + 1, len);
 
                // Remove a character 'new line' at the end of the string
                group_list[len - 1] = '\0';
--
2.25.1



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to