public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>, Roland McGrath <roland@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>, kimdon@esrf.fr
Subject: [PATCH] Fix BZ #218
Date: Mon, 14 Jun 2004 13:15:00 -0000	[thread overview]
Message-ID: <20040614110041.GT5191@sunsite.ms.mff.cuni.cz> (raw)

Hi!

By saving address of pml_next we actually did not help ourselves at all,
next still points into freed memory after xdr_reference and thus cannot be
read nor written.
The patch in bugzilla doesn't help much, it adds to a read from freed
memory in xdr_reference also a write into freed memory.

2004-06-14  Jakub Jelinek  <jakub@redhat.com>

	[BZ #218]
	* sunrpc/pmap_prot2.c (xdr_pmaplist): When freeing, remember pml_next
	in a local variable, point rp to that local variable afterwards.

--- libc/sunrpc/pmap_prot2.c.jj	2002-02-26 02:43:56.000000000 +0100
+++ libc/sunrpc/pmap_prot2.c	2004-06-14 15:01:45.489088043 +0200
@@ -93,7 +93,7 @@ xdr_pmaplist (xdrs, rp)
    */
   bool_t more_elements;
   int freeing = (xdrs->x_op == XDR_FREE);
-  struct pmaplist **next = NULL;
+  struct pmaplist *next = NULL;
 
   while (TRUE)
     {
@@ -108,12 +108,12 @@ xdr_pmaplist (xdrs, rp)
        * before we free the current object ...
        */
       if (freeing)
-	next = &((*rp)->pml_next);
+	next = (*rp)->pml_next;
       if (!INTUSE(xdr_reference) (xdrs, (caddr_t *) rp,
 				  (u_int) sizeof (struct pmaplist),
 				  (xdrproc_t) INTUSE(xdr_pmap)))
 	  return FALSE;
-      rp = freeing ? next : &((*rp)->pml_next);
+      rp = freeing ? &next : &((*rp)->pml_next);
     }
 }
 INTDEF(xdr_pmaplist)

	Jakub

             reply	other threads:[~2004-06-14 13:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-14 13:15 Jakub Jelinek [this message]
2004-06-18  2:27 ` Ulrich Drepper

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=20040614110041.GT5191@sunsite.ms.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=kimdon@esrf.fr \
    --cc=libc-hacker@sources.redhat.com \
    --cc=roland@redhat.com \
    /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).