netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: tipc-discussion@lists.sourceforge.net,
	kernel-janitors@lists.osdl.org, netdev@vger.kernel.org
Subject: Re: [KJ] [tipc-discussion] [patch] net/tipc: sprintf/strcpy	conversion
Date: Thu, 02 Nov 2006 08:57:55 +0100	[thread overview]
Message-ID: <4549A503.5040005@bfs.de> (raw)
In-Reply-To: <20061102062656.GA8339@Chamillionaire.breakpoint.cc>



Florian Westphal wrote:
> walter harms <wharms@bfs.de> wrote:
>> These line
>> +       strcpy(bcbearer->media.name, "tipc-multicast");
>> i gues that means tipc_bclink_name ?
> 
> The idea was to change how things are done, not _what_ is being done.
> 
>> an even more secure version could be like this:
>>
>> 	strncpy(bcbearer->media.name,sizeof(bcbearer->media.name),tipc_bclink_name);
> 
> Ugh, please, no. The size of src is known in all cases; there is
> absoluty no point in using str(n|l)cpy here.
> 
>> (in case someone ever changes the size of cbearer->media.name or tipc_bclink_name and the hope
>> that wchat_t will never reach the kernel)
> 
> In this case 'someone' should be really hurt, don't you think?
> 

hi florian,
i am on the side of error, the code increase is marginal and the speed penalty also, so why not ?
you make sure that an overflow may never happen, and the rest in name gets zeroed.

The problem is that when the error occurs it may be later than the actual changeset.
NTL it is an hint, and if you feel ok with it and the maintainer has no objects i have no problems either.

re,
 wh



  reply	other threads:[~2006-11-02  7:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-01 14:06 [patch] net/tipc: sprintf/strcpy conversion Florian Westphal
2006-11-01 21:38 ` [KJ] " walter harms
2006-11-01 23:19   ` David Miller
2006-11-02  7:45     ` walter harms
2006-11-02  6:26   ` [tipc-discussion] " Florian Westphal
2006-11-02  7:57     ` walter harms [this message]
2006-11-03  0:09 ` Alexey Dobriyan
2006-11-03 10:50   ` Hagen Paul Pfeifer

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=4549A503.5040005@bfs.de \
    --to=wharms@bfs.de \
    --cc=kernel-janitors@lists.osdl.org \
    --cc=netdev@vger.kernel.org \
    --cc=tipc-discussion@lists.sourceforge.net \
    /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).