Re: [Bf-committers] strcmp->strncmp code update

2011-06-26 Thread Johan C.
2011/6/26 Campbell Barton > blenders strings are assumed to be zero terminated in many places so > using strncpy and strncmp are not especially making blenders code less > vulnerable to buffer overruns unless our own internal functions also > accept a string lengths. > > You probably mean the ble

Re: [Bf-committers] strcmp->strncmp code update

2011-06-26 Thread Johan C.
FYI, here's the perl code to translate strcmp to strncmp...perhaps it only needs some other regex cases. #!/usr/bin/perl -wT use strict; while () { if (/(strcmp\()+/) { if (/\((\w+)\((\w*)(\W*)(\w*)(\W*)(\w*)(\W*)(\, )(\w*)(\W*)\)/) { prin

Re: [Bf-committers] strcmp->strncmp code update

2011-06-26 Thread Johan C.
2011/6/26 Sergey I. Sharybin > Hi, > > I can't see how such kind of replacement would help us. And we can't use > cstring dur to Blender is mostly written in C, not C++. > > Not true. There is much C++ code which should use , strncmp or even glib::ustring for UTF. > Johan C. wrote: > > Hi, > >

Re: [Bf-committers] strcmp->strncmp code update

2011-06-26 Thread Campbell Barton
blenders strings are assumed to be zero terminated in many places so using strncpy and strncmp are not especially making blenders code less vulnerable to buffer overruns unless our own internal functions also accept a string lengths. On Sun, Jun 26, 2011 at 5:14 PM, Sergey I. Sharybin wrote: >  H

Re: [Bf-committers] strcmp->strncmp code update

2011-06-26 Thread Sergey I. Sharybin
Hi, I can't see how such kind of replacement would help us. And we can't use cstring dur to Blender is mostly written in C, not C++. Johan C. wrote: > Hi, > > It'd be best to rewrite the strcmp functions with strncmp and using > #include instead of libc string.h . > > So strcmp(1,2) would bec

[Bf-committers] strcmp->strncmp code update

2011-06-26 Thread Johan C.
Hi, It'd be best to rewrite the strcmp functions with strncmp and using #include instead of libc string.h . So strcmp(1,2) would become std::strncmp(1,2,std::strlen(2)); Love, erana PS: You can patch it with a line of perl. ___ Bf-committers mailing l