Fix crash and memory leak in $aliasctl(COMMAND MATCH)
glob_commands() would run off the end of the irc_command array if given a match that matched the last command. It also leaked memory because it used m_s3cat() to construct the string, then passed that to m_strdup(). This fixes these problems by reworking glob_commands(), and at the same time removes the use of alloca() and wild_match() by using strncmp() instead to match the start of a string. Move glob_commands() to alias.c and make it static since it's only used for aliasctl(). Change the 'name' argument of find_command() and find_dll_command() to const char * at the same time, so that glob_commands()'s prefix argument can be const char * too.
This commit is contained in:
Reference in New Issue
Block a user