netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Denis Kirjanov <kirjanov@gmail.com>, stephen@networkplumber.org
Cc: netdev@vger.kernel.org, Denis Kirjanov <dkirjanov@suse.de>
Subject: Re: [PATCH v2 iproute2] ifstat: convert sprintf to snprintf
Date: Tue, 6 Feb 2024 18:05:52 -0700	[thread overview]
Message-ID: <fa61cd41-a0ec-4b01-aa2e-577a1b15cef3@gmail.com> (raw)
In-Reply-To: <20240202093527.38376-1-dkirjanov@suse.de>

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?

  reply	other threads:[~2024-02-07  1:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02  9:35 [PATCH v2 iproute2] ifstat: convert sprintf to snprintf Denis Kirjanov
2024-02-07  1:05 ` David Ahern [this message]
2024-02-07  3:13   ` Stephen Hemminger
2024-02-10 20:33 ` Stephen Hemminger
2024-02-11  8:39   ` Denis Kirjanov
2024-02-11 17:18     ` Stephen Hemminger
2024-02-11 18:10       ` Denis Kirjanov

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=fa61cd41-a0ec-4b01-aa2e-577a1b15cef3@gmail.com \
    --to=dsahern@gmail.com \
    --cc=dkirjanov@suse.de \
    --cc=kirjanov@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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 NNTP newsgroup(s).