Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
In this non-compliant code example, the call to {{strpcy()}} has been replaced with a call to {{strcpy_s()}}.  See \[[STR00-A. Use TR 24731 for remediation of existing string manipulation code]\] for more information on using {{strcpy_s()}}.

...

Code Block
bgColor#ccccff
char system_msg[100];
/* ... */
void error_message(char *error_msg) {
  char default_msg[80];
  /* ... */

  /* error_msg is assumed to reference a NTBS of length 99 or less */  
  errno_t e = strcpy_s(system_msg, 100sizeof(system_msg), error_msg);
  if (e != 0) {
     /* handle strcpy_s() error */
  }
}

...