Copy the string first, since shell_output_str() does not ensure constness of the first string

This commit is contained in:
Adam Dunkels 2011-08-31 22:03:31 +02:00
parent add8367947
commit 4e5d3217ca

View file

@ -58,7 +58,9 @@ PROCESS_THREAD(shell_ps_process, ev, data)
shell_output_str(&ps_command, "Processes:", "");
for(p = PROCESS_LIST(); p != NULL; p = p->next) {
shell_output_str(&ps_command, PROCESS_NAME_STRING(p), "");
char namebuf[30];
strncpy(namebuf, PROCESS_NAME_STRING(p), sizeof(namebuf));
shell_output_str(&ps_command, namebuf, "");
}
PROCESS_END();