From: Steve Dickson <steved@redhat.com>
To: Scott Mayhew <smayhew@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [nfs-utils PATCH 1/2] junction: fix buffer over-read in junction_parse_xml_read()
Date: Wed, 16 Sep 2026 10:16:19 -0400 [thread overview]
Message-ID: <2c15e85c-220a-483e-b5f5-a6dcda61122f@redhat.com> (raw)
In-Reply-To: <20260903175313.1214070-2-smayhew@redhat.com>
On 9/3/26 1:53 PM, Scott Mayhew wrote:
> junction_get_xattr() returns an opaque buffer, but
> junction_parse_xml_read() treats it as a string by passing it to xlog().
> Fix it by allocating an extra byte and null-terminating the buffer in
> junction_get_xattr().
>
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... (tag: nfs-utils-2-9-3-rc4)
steved.
> ---
> support/junction/junction.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/support/junction/junction.c b/support/junction/junction.c
> index c1ec8ff8..04a8ebf1 100644
> --- a/support/junction/junction.c
> +++ b/support/junction/junction.c
> @@ -293,7 +293,7 @@ junction_get_xattr(int fd, const char *path, const char *name, void **contents,
> return FEDFS_ERR_ACCESS;
> }
>
> - xattrbuf = malloc((size_t)len);
> + xattrbuf = malloc((size_t)len + 1);
> if (xattrbuf == NULL) {
> xlog(D_GENERAL, "%s: failed to get buffer for xattr %s on %s",
> __func__, name, path);
> @@ -307,6 +307,7 @@ junction_get_xattr(int fd, const char *path, const char *name, void **contents,
> return FEDFS_ERR_ACCESS;
> }
>
> + ((char *) xattrbuf)[len] = '\0';
> xlog(D_CALL, "%s: read xattr %s from path %s",
> __func__, name, path);
> *contents = xattrbuf;
next prev parent reply other threads:[~2026-09-16 14:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 17:53 [nfs-utils PATCH 0/2] Two hardening fixes for junction handling Scott Mayhew
2026-09-03 17:53 ` [nfs-utils PATCH 1/2] junction: fix buffer over-read in junction_parse_xml_read() Scott Mayhew
2026-09-16 14:16 ` Steve Dickson [this message]
2026-09-03 17:53 ` [nfs-utils PATCH 2/2] junction: fix use-after-free in locations_to_fslocdata() Scott Mayhew
2026-09-16 14:11 ` Steve Dickson
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=2c15e85c-220a-483e-b5f5-a6dcda61122f@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=smayhew@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