* Alexey Dobriyan | 2006-11-03 03:09:05 [+0300]:
>On Wed, Nov 01, 2006 at 03:06:24PM +0100, Florian Westphal wrote:
>> convert sprintf(a,b) to strcpy(a,b). Make tipc_bclink_name[] const.
>
>Ahhh, I missed the start of threads.
>
>Patch is useless because it changes one unbounded string function into
>another unbounded string function.
The discussion in this thread is really back-breaking!
1. To make tipc_bclink_name const there is absolutly no objection
2. Replace sprintf with strcpy
a) First of all: If you _copy_ a string then use also strCPY()
Thats a question of good style!
b) If the compiler is smart enough, he realize that you want to copy
a string and replace the sprintf call with a
pushl %ebx
call strcpy
Surprise - Surprise!
Assumed you use gcc with -Os or -O2! Don't know how icc handle this
case. If you compile without optimization you save at least a
"repz movsb %ds:(%esi),%es:(%edi)" instruction.
c) Last but not least I read all the time this patch doesn't introduce
bounds-checking. This isn't a argument because the author is aware of
the destination length of the buffer. BTW: grep for (sprintf|strcpy) in
/usr/src/linux and be surprised how unsecure the kernel is (thats
ironical).
This patch is 100% OK!
HGN
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html