3 ms·
Quick grep on linux-2.6.37.3: strcpy -> 2864 strncpy -> 894
by program 16y ago
Quick grep on linux-2.6.37.3:
strcpy -> 2864
strncpy -> 894
- anon1385 16y agohow many times is strlcpy used? This bug was fixed with strlcpy: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eaae55dac6b64c0616046436b294e69fc5311581 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6...
- jazzyb 16y agoProbably not much: http://en.wikipedia.org/wiki/Strlcpy#Criticism http://en.wikipedia.org/wiki/Strlcpy#Criticism
- anon1385 16y agoFortunately, Ulrich Drepper doesn't work on the kernel. Otherwise we would all have to pay money to open bug reports[1] His preferred solution is to use the highly portable *((char *) mempcpy (dst, src, n)) = '\0'; make of that what you will… [1] http://sourceware.org/bugzilla/show_bug.cgi?id=4980 http://sourceware.org/bugzilla/show_bug.cgi?id=4980
- program 16y agostrlcpy -> 1063
- yan 16y agostrncpy isn't always better. It's just as easy to misuse strncpy as it is to properly sanitize strcpy inputs.