Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos



Bugtraq: Re: strcpy versus strncpy

Re: strcpy versus strncpy

From: Eivind Eklund <eivind_at_YES.NO>
Date: Tue, 3 Mar 1998 09:53:17 +0100

On Tue, Mar 03, 1998 at 01:31:24AM +0100, Morten Welinder wrote:
> A recent article on BugTraq suggested that using strcpy should
> almost always be considered a bug. That's not right. It is,
> in fact, the wrong way around: strncpy is almost always a bug.
>
> True, strncpy will avoid buffer overruns, but that only proven
> that strncpy is better than incorrect use of strcpy. The problem
> is that such use of strncpy can introduce problems of its own:

The correct function to use for avoiding buffer overruns would be
sancpy() - strcpy with abort on overflow. Too bad nothing have the
function available at the moment - it is on the list of possible
enhancements for FreeBSD. The same goes for sanprintf().

Eivind.
Received on Mar 03 1998

[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
edgeos