diff options
| author | tomsmeding <tom.smeding@gmail.com> | 2017-05-24 11:47:49 +0200 | 
|---|---|---|
| committer | tomsmeding <tom.smeding@gmail.com> | 2017-05-24 11:47:49 +0200 | 
| commit | 438254db34608808f7d521fe871e21393542c556 (patch) | |
| tree | 98f7db24aa2e0d43da154e058572eedc71a26728 | |
| parent | 24e9d1ea30092f2b0ee938b279108e71edcb5239 (diff) | |
server: Actually check the entire command name
Previously, l(o(g(in?)?)?)? meant "login", since only the cmdlen
prefix of the registered command was matched against the sent command.
Discovered by surprisedly seeing "list_room" work.
| -rw-r--r-- | command.c | 3 | 
1 files changed, 2 insertions, 1 deletions
| @@ -362,7 +362,8 @@ bool handle_input_line(struct conn_data *data,char *line,size_t linelen){  	size_t cmdlen=sepp-line;  	size_t cmdi;  	for(cmdi=0;cmdi<NCOMMANDS;cmdi++){ -		if(strncmp(line,commands[cmdi].cmdname,cmdlen)==0){ +		if(cmdlen==strlen(commands[cmdi].cmdname)&& +				memcmp(line,commands[cmdi].cmdname,cmdlen)==0){  			break;  		}  	} | 
