The ICS translatese some commands (like 'storedmoves') to others
(like 'smoves'), which are then also subject to aliasing. Defining the
reverse substitution as alias then leads to infinite recursion.
The recursion is now limited to 10 levels, and makes the command fail
otherwise.
/* Process a command for a user */
int pcommand(int p, char *comstr,...)
{
+ static int recurse = 0;
struct player *pp = &player_globals.parray[p];
char *tmp;
int retval;
int current_socket = pp->socket;
va_list ap;
+ if(recurse > 10) return COM_BADPARAMETERS; /* [HGM] guard against infinite recursion through bad aliasing */
+
va_start(ap, comstr);
vasprintf(&tmp, comstr, ap);
va_end(ap);
+ recurse++;
retval = process_input(current_socket, tmp);
+ recurse--;
free(tmp);
if (retval == COM_LOGOUT) {
process_disconnection(current_socket);