about summary refs log tree commit diff
path: root/hurd/hurdauth.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-02 01:08:38 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-02 11:36:11 +0100
commit6514b2d59545300b27785abaaacd0115ff61a18d (patch)
treeb2be639e871441dda6aaf1da64d2e8502c32f5ae /hurd/hurdauth.c
parent3a614f39e61140dd2478ce5b7564ec8a53269ea4 (diff)
downloadglibc-6514b2d59545300b27785abaaacd0115ff61a18d.tar.gz
glibc-6514b2d59545300b27785abaaacd0115ff61a18d.tar.xz
glibc-6514b2d59545300b27785abaaacd0115ff61a18d.zip
hurd _S_msg_add_auth: Initialize new arrays to 0
If make_list fails, they would be undefined, and freeup with free
uninitialized pointers.
Diffstat (limited to 'hurd/hurdauth.c')
-rw-r--r--hurd/hurdauth.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hurd/hurdauth.c b/hurd/hurdauth.c
index 9086e9484c..25cc8ee88d 100644
--- a/hurd/hurdauth.c
+++ b/hurd/hurdauth.c
@@ -101,21 +101,24 @@ _S_msg_add_auth (mach_port_t me,
   __mutex_lock (&_hurd_id.lock);
   _hurd_check_ids ();
 
-#define MAKE(genaux,uidgid) 						    \
-  make_list (&new ## genaux ## uidgid ## s, 				    \
+#define MAKE(genaux,uidgid) ({						    \
+  new ## genaux ## uidgid ## s = 0;					    \
+  nnew ## genaux ## uidgid ## s = 0;					    \
+  make_list (&new ## genaux ## uidgid ## s,				    \
 	     &nnew ## genaux ## uidgid ## s,				    \
 	     _hurd_id.genaux.uidgid ## s,				    \
 	     _hurd_id.genaux.n ## uidgid ## s,				    \
 	     genaux ## uidgid ## s,					    \
-	     n ## genaux ## uidgid ## s)
+	     n ## genaux ## uidgid ## s);				    \
+})
 
   err = MAKE (gen, uid);
   if (!err)
-    MAKE (aux, uid);
+    err = MAKE (aux, uid);
   if (!err)
-    MAKE (gen, gid);
+    err = MAKE (gen, gid);
   if (!err)
-    MAKE (aux, gid);
+    err = MAKE (aux, gid);
 #undef MAKE
 
   __mutex_unlock (&_hurd_id.lock);