mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
Use g_strchomp to remove trailing whitespace.
This fixes an invalid read, when the string is empty, reported by Enrico Scholz. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4717 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
4e2fcc71ae
commit
2e63374f31
@ -252,12 +252,10 @@ static void show_help(const char *data)
|
|||||||
/* SYNTAX: HELP [<command>] */
|
/* SYNTAX: HELP [<command>] */
|
||||||
static void cmd_help(const char *data)
|
static void cmd_help(const char *data)
|
||||||
{
|
{
|
||||||
char *cmd, *ptr;
|
char *cmd;
|
||||||
|
|
||||||
cmd = g_strdup(data);
|
cmd = g_strdup(data);
|
||||||
ptr = cmd+strlen(cmd);
|
g_strchomp(cmd);
|
||||||
while (ptr[-1] == ' ') ptr--; *ptr = '\0';
|
|
||||||
|
|
||||||
g_strdown(cmd);
|
g_strdown(cmd);
|
||||||
show_help(cmd);
|
show_help(cmd);
|
||||||
g_free(cmd);
|
g_free(cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user