diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2008-03-02 19:54:34 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2008-03-02 19:54:34 +0000 |
commit | 2e63374f31e933e9ca62d7174f9bc85bc943500d (patch) | |
tree | 37a52ab3b27834e6d7bd98f589c3565ac300068a | |
parent | 4e2fcc71ae8c699c07af760dff73d29e0aaf89ce (diff) | |
download | irssi-2e63374f31e933e9ca62d7174f9bc85bc943500d.zip |
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
-rw-r--r-- | src/fe-common/core/fe-help.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/fe-common/core/fe-help.c b/src/fe-common/core/fe-help.c index 76e4c6d2..09485fac 100644 --- a/src/fe-common/core/fe-help.c +++ b/src/fe-common/core/fe-help.c @@ -252,12 +252,10 @@ static void show_help(const char *data) /* SYNTAX: HELP [<command>] */ static void cmd_help(const char *data) { - char *cmd, *ptr; + char *cmd; cmd = g_strdup(data); - ptr = cmd+strlen(cmd); - while (ptr[-1] == ' ') ptr--; *ptr = '\0'; - + g_strchomp(cmd); g_strdown(cmd); show_help(cmd); g_free(cmd); |