...
Wiki Markup |
---|
The following functions are obsolescent and should be avoided in favor of either the portable equivalent or, if available, the more secure alternativealternatives defined in \[[ISO/IEC TR 24731-1|AA. Bibliography#ISO/IEC TR 24731-1-2007]\] Extensions to the C Library, â--- Part I: Bounds-checking interfaces, and \[[ISO/IEC TR 24731-2|AA. Bibliography#ISO/IEC TR 24731-2-2010]\] Extensions to the C Library, --- Part II: xxxx. [xxxx add the Part II functions in the list below] |
Function | Portable Equivalent | Secure Alternative |
---|---|---|
|
| |
| |
|
| |
|
| |
|
| |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
|
| |
|
|
| |
|
| |
|
| |
|
| |
| | |
| | |
|
| |
| | |
| | |
|
| |
|
| |
| | |
| |
|
| | |
| |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
...
In this compliant solution, strcat()
and strcpy()
are replaced by strcat_s()
and strcpy_s()
.
Code Block | ||
---|---|---|
| ||
enum { BUFFERSIZE=256 };
void complain(const char *msg) {
static const char prefix[] = "Error: ";
static const char suffix[] = "\n";
char buf[BUFFERSIZE];
strcpy_s(buf, BUFFERSIZE, prefix);
strcat_s(buf, BUFFERSIZE, msg);
strcat_s(buf, BUFFERSIZE, suffix);
fputs(buf, stderr);
}
|
...