Send one extra byte to ensure that the terminating zero is included

This commit is contained in:
adamdunkels 2008-07-03 09:51:21 +00:00
parent 0000a091cc
commit 09f5b6d2f5

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: shell-rime-netcmd.c,v 1.1 2008/02/05 20:35:21 adamdunkels Exp $ * $Id: shell-rime-netcmd.c,v 1.2 2008/07/03 09:51:21 adamdunkels Exp $
*/ */
/** /**
@ -53,8 +53,6 @@
#include "net/rime/timesynch.h" #include "net/rime/timesynch.h"
#define WITH_DEBUG_COMMANDS 0
#if NETSIM #if NETSIM
#include "ether.h" #include "ether.h"
#endif /* NETSIM */ #endif /* NETSIM */
@ -118,7 +116,7 @@ PROCESS_THREAD(shell_netcmd_process, ev, data)
rimebuf_clear(); rimebuf_clear();
msg = rimebuf_dataptr(); msg = rimebuf_dataptr();
rimebuf_set_datalen(len + 1); rimebuf_set_datalen(len + 2);
strcpy(msg->netcmd, data); strcpy(msg->netcmd, data);
/* printf("netcmd sending '%s'\n", msg->netcmd);*/ /* printf("netcmd sending '%s'\n", msg->netcmd);*/
trickle_send(&trickle); trickle_send(&trickle);
@ -141,7 +139,7 @@ recv_trickle(struct trickle_conn *c)
is should be already). */ is should be already). */
msg->netcmd[rimebuf_datalen() - 2] = 0; msg->netcmd[rimebuf_datalen() - 2] = 0;
/* Start the server process with the incoming command. */ /* Start the server process with the incoming command. */
process_start(&shell_netcmd_server_process, msg->netcmd); process_start(&shell_netcmd_server_process, msg->netcmd);
} }