[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240206191335.27e2b869@hermes.local>
Date: Tue, 6 Feb 2024 19:13:35 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: David Ahern <dsahern@...il.com>
Cc: Denis Kirjanov <kirjanov@...il.com>, netdev@...r.kernel.org, Denis
Kirjanov <dkirjanov@...e.de>
Subject: Re: [PATCH v2 iproute2] ifstat: convert sprintf to snprintf
On Tue, 6 Feb 2024 18:05:52 -0700
David Ahern <dsahern@...il.com> wrote:
> On 2/2/24 2:35 AM, Denis Kirjanov wrote:
> > @@ -893,7 +893,7 @@ int main(int argc, char *argv[])
> >
> > sun.sun_family = AF_UNIX;
> > sun.sun_path[0] = 0;
> > - sprintf(sun.sun_path+1, "ifstat%d", getuid());
> > + snprintf(sun.sun_path + 1, sizeof(sun.sun_path), "ifstat%d", getuid());
>
> sizeof(sun.sun_path) - 1 since the start is +1?
>
> and that is an odd path. Stephen do you know the origin of
> "\0ifstat<uid>" for the path?
Yes that is abstract unix domain socket address.
Which avoids many issues with filesystem based Unix domain sockets.
Powered by blists - more mailing lists