public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] hurd _S_msg_add_auth: Initialize new arrays to 0
Date: Mon,  2 Jan 2023 10:36:21 +0000 (GMT)	[thread overview]
Message-ID: <20230102103621.64A473858D38@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6514b2d59545300b27785abaaacd0115ff61a18d

commit 6514b2d59545300b27785abaaacd0115ff61a18d
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Mon Jan 2 01:08:38 2023 +0100

    hurd _S_msg_add_auth: Initialize new arrays to 0
    
    If make_list fails, they would be undefined, and freeup with free
    uninitialized pointers.

Diff:
---
 hurd/hurdauth.c | 15 +++++++++------
 1 file 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);

                 reply	other threads:[~2023-01-02 10:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230102103621.64A473858D38@sourceware.org \
    --to=sthibaul@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).