fix bug in example of assuming 0 termination of "data" as its not a

string.



SVN revision: 74226
This commit is contained in:
Carsten Haitzler 2012-07-20 09:40:03 +00:00
parent 2ead8b85c2
commit 2fcec3db4b
1 changed files with 10 additions and 1 deletions

View File

@ -12,8 +12,17 @@ static Eina_Bool
_msg_from_child_handler(void *data, int type, void *event)
{
Ecore_Exe_Event_Data *dataFromProcess = (Ecore_Exe_Event_Data *)event;
char *msg = (char *)dataFromProcess->data;
char msg[BUFFER_SIZE];
if (dataFromProcess->size >= (BUFFER_SIZE - 1))
{
fprintf(stdout, "Data too big for bugger. error\n");
return ECORE_CALLBACK_DONE;
}
strncpy(msg, dataFromProcess->data, dataFromProcess->size);
msg[dataFromProcess->size = 0;
if (strcmp(msg, "quit") == 0)
{
fprintf(stdout, "My child said to me, QUIT!\n");