Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

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
> developers."*

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

  • Original Message ----- From: "Michael Howard" <mikehow@microsoft.com> To: <phani@myrealbox.com>; <secprog@securityfocus.com> Sent: Friday, November 15, 2002 7:00 PM Subject: RE: Are bad developer libraries the problem with M$ software?

"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.

Do you need help?X

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) {
  WCHAR szTmp[MAX_PATH];
  LPCWSTR szExtSrc;
  LPWSTR szExtDst;

  wcsncpy( szTmp, bstrURL, MAXSTRLEN(szTmp) );   szTmp[MAXSTRLEN(szTmp)] = 0;

  szExtSrc = wcsrchr( bstrURL, '.' );
  szExtDst = wcsrchr( szTmp , '.' );

  if(szExtDst) {
    szExtDst[0] = 0;

    if(m_inst.m_fDesktop) {

      wcsncat( szTmp, L"__DESKTOP", MAXSTRLEN(szTmp) ); 
      wcsncat( szTmp, szExtSrc    , MAXSTRLEN(szTmp) ); 
Do you need more help?X

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

  • there is one function that is impossible to use securely -> gets() :-)

Cheers, Michael
Secure Windows Initiative
Writing Secure Code
http://www.microsoft.com/mspress/books/5612.asp Received on Sat Nov 16 11:47:49 2002

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:44 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library