I was looking through the source and think I found a problem with it, hoping someone can clarify.
line 167 – if(command_buffer_count == (2*MAX_COMMAND_LENGTH))return 0; //If the command is too long, exit the function
Why 2*MAX_COMMAND_LENGTH? Are you not going to write passed the end of command_buffer and possibly overwrite something, if a command longer than MAX_COMMAND_LENGTH is accidentally sent
should it not be
line 167 – if(command_buffer_count == (MAX_COMMAND_LENGTH))return 0; //If the command is too long, exit the function