|
|||||||||||
|
Re: Are bad developer libraries the problem with M$ software?
From: Alex Lambert <alambert(at)webmaster.com>
Date: Sat Nov 16 2002 - 10:29:57 EST > "There is no such thing as dangerous functions, only dangerous
Perl's print statement is safe, right? No buffer overflows *there*... print 'Hello, '.$query->param('name'); Except now I'm vulnerable to cross-site scripting :) apl
"There is no such thing as dangerous functions, only dangerous developers."* "secure" functions are a complete crok - there is no such thing... There are some functions that help you get things right, but they do not lead to secure code... Anyone who thinks they can do away with the "dangerous" functions and replace them with the "safe" 'n' versions (ie; strcpy -> strncpy) is kidding themselves. The issue is the DATA, not the code. Do you trust the data? You need to determine at which point in the code is the data well-formed and correct. The ONLY way to build secure code is to question the assumptions about the trustworthiness of the data as it crosses untrusted to trusted boundaries, not hunting down "insecure" functions. Here's an example: wassup with this code? #define MAXSTRLEN(x) (sizeof(x)/sizeof(x[0]))
if (bstrURL != NULL) {
wcsncpy( szTmp, bstrURL, MAXSTRLEN(szTmp) ); szTmp[MAXSTRLEN(szTmp)] = 0;
szExtSrc = wcsrchr( bstrURL, '.' );
if(szExtDst) {
if(m_inst.m_fDesktop) {
wcsncat( szTmp, L"__DESKTOP", MAXSTRLEN(szTmp) );
wcsncat( szTmp, szExtSrc , MAXSTRLEN(szTmp) );
It's secure, right? 'coz I'm using the 'secure' 'n' versions!!!? No, it's not.. I'll leave that as an exercise for the reader
Cheers, Michael
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:44 EDT |
||||||||||
|
|||||||||||