Article 72FXC Stenberg: No strcpy either

Stenberg: No strcpy either

by
jzb
from LWN.net on (#72FXC)

Daniel Stenberg has written a blogpost about the decision to ban the use strcpy()in curl:

The main challenge with strcpy is that when using it we do notspecify the length of the target buffer nor of the source string. [...]

To make sure that the size checks cannot be separated from the copyitself we introduced a string copy replacement function the other daythat takes the target buffer, target size,source buffer and source string length as argumentsand only if the copy can be made and the null terminator also fitsthere, the operation is done.

External Content
Source RSS or Atom Feed
Feed Location http://lwn.net/headlines/rss
Feed Title LWN.net
Feed Link https://lwn.net/
Reply 0 comments