...
This compliant solution uses different, more descriptive variable names.
Code Block | ||
---|---|---|
| ||
{mc}
ANKUR
{mc}
char system_msg[100];
void report_error(const char *error_msg) {
char default_msg[80];
/* ... */
if (error_msg)
strncpy(system_msg, error_msg, sizeof(system_msg));
else
strncpy(system_msg, default_msg, sizeof(system_msg));
system_msg[ sizeof(system_msg) - 1] = '\0';
return;
}
int main(void) {
char error_msg[80];
/* ... */
report_error(error_msg);
/* ... */
}
|
...