Q: Garbage Backspace Command Line I have made a programm, in C, that reads commands from keyboard and writes them, it works like this:
put this is stackoverflow



*

*opcode: put

*data: this is

*key: stackoverflow
Sometimes when I' m writting the command and I do a backspace it leaves garbage:
data: a`�
The code is very complex but here are some pieces of it:
    printf("data: %s\n",(char*)msg->content.value->data);//data is *void

    ...
    char command[MAX_MSG];
    fgets(command, sizeof(command), stdin);

    command[strcspn (command, "\n")] = '\0';
    aux_command_key = strdup(command);
    aux_command_data = strdup(aux_command_key);

    if(strcmp(opcode, "put") == 0){
           sendMessage->opcode = OC_PUT;
           sendMessage->c_type = CT_ENTRY;
           char *key = getKey(aux_command_key, opcode);

           if(key == NULL){
                     printf("Invalid number of arguments.\n");
                     success = -1;
           }

           else{
                     key = strdup(key);
                     char *data = strdup(getData(aux_command_data, opcode, key));                   sendMessage->content.entry = entry_create(key, data_create2(strlen(data), data));
           }
     }
     ...
     else if(strcmp(opcode, "get") == 0){
           sendMessage->opcode = OC_GET;            
           sendMessage->c_type = CT_KEY;
           char *key = getKey(aux_command_key, opcode);

           if(key == NULL){
                     printf("Invalid number of arguments.\n");
                     success = -1;
           }

           else{
                     key = strdup(key);
                     sendMessage->content.key = key;
           }
     }

Is this normal or can I be doing something wrong? 
