* [PATCH] rpcinfo: stack buffer overflow in rpcinfo rpcbdump()
@ 2026-08-28 15:38 Krzesimir Nowak
2026-09-05 17:36 ` Steve Dickson
0 siblings, 1 reply; 2+ messages in thread
From: Krzesimir Nowak @ 2026-08-28 15:38 UTC (permalink / raw)
To: linux-nfs; +Cc: qdlacz, Krzesimir Nowak, Michalis Vasileiadis
rpcinfo's rpcbdump() formats a server-controlled list of versions into
a fixed size buffer with sprintf(). A malicious server returning a
large number of versions may overflow it.
Reported-by: Michalis Vasileiadis <vmihalis.tmd@gmail.com>
Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
---
src/rpcinfo.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/rpcinfo.c b/src/rpcinfo.c
index 30d535e..9917913 100644
--- a/src/rpcinfo.c
+++ b/src/rpcinfo.c
@@ -958,17 +958,19 @@ rpcbdump (
for (rs = rs_head; rs; rs = rs->next)
{
size_t netidmax = sizeof(buf) - 1;
- char *p = buf;
+ int l = 0;
printf ("%10ld ", rs->prog);
for (vl = rs->vlist; vl; vl = vl->next)
{
- sprintf (p, "%d", vl->vers);
- p = p + strlen (p);
+ l += printf ("%d", vl->vers);
if (vl->next)
- sprintf (p++, ",");
+ l += printf (",");
}
- printf ("%-10s", buf);
+ if (l < 10)
+ printf("%*s", 10 - l, " ");
+ else
+ printf(" ");
buf[0] = '\0';
for (nl = rs->nlist; nl; nl = nl->next)
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] rpcinfo: stack buffer overflow in rpcinfo rpcbdump()
2026-08-28 15:38 [PATCH] rpcinfo: stack buffer overflow in rpcinfo rpcbdump() Krzesimir Nowak
@ 2026-09-05 17:36 ` Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2026-09-05 17:36 UTC (permalink / raw)
To: Krzesimir Nowak, linux-nfs; +Cc: Krzesimir Nowak, Michalis Vasileiadis
On 8/28/26 11:38 AM, Krzesimir Nowak wrote:
> rpcinfo's rpcbdump() formats a server-controlled list of versions into
> a fixed size buffer with sprintf(). A malicious server returning a
> large number of versions may overflow it.
>
> Reported-by: Michalis Vasileiadis <vmihalis.tmd@gmail.com>
> Signed-off-by: Krzesimir Nowak <knowak@microsoft.com>
Committed... (tag: rpcbind-1_2_9-rc2)
steved.
> ---
> src/rpcinfo.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/src/rpcinfo.c b/src/rpcinfo.c
> index 30d535e..9917913 100644
> --- a/src/rpcinfo.c
> +++ b/src/rpcinfo.c
> @@ -958,17 +958,19 @@ rpcbdump (
> for (rs = rs_head; rs; rs = rs->next)
> {
> size_t netidmax = sizeof(buf) - 1;
> - char *p = buf;
> + int l = 0;
>
> printf ("%10ld ", rs->prog);
> for (vl = rs->vlist; vl; vl = vl->next)
> {
> - sprintf (p, "%d", vl->vers);
> - p = p + strlen (p);
> + l += printf ("%d", vl->vers);
> if (vl->next)
> - sprintf (p++, ",");
> + l += printf (",");
> }
> - printf ("%-10s", buf);
> + if (l < 10)
> + printf("%*s", 10 - l, " ");
> + else
> + printf(" ");
> buf[0] = '\0';
>
> for (nl = rs->nlist; nl; nl = nl->next)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-05 17:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 15:38 [PATCH] rpcinfo: stack buffer overflow in rpcinfo rpcbdump() Krzesimir Nowak
2026-09-05 17:36 ` Steve Dickson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.