summaryrefslogtreecommitdiff
path: root/src/core/wee-string.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-12-31 19:07:14 +0100
committerSébastien Helleu <flashcode@flashtux.org>2015-12-31 19:07:14 +0100
commit57b6e320d3c9d2d9473090eb3881de206c81e52c (patch)
tree04e7783733c8b900aa44bfee27403d92bd0cc671 /src/core/wee-string.c
parent295158d3e1cd148315d5c383da5980c3e1157396 (diff)
downloadweechat-57b6e320d3c9d2d9473090eb3881de206c81e52c.zip
core: fix execution of empty command name
The strings "/" and "/ " are not considered as valid commands any more.
Diffstat (limited to 'src/core/wee-string.c')
-rw-r--r--src/core/wee-string.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 9ae23d7f3..f973f5800 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -2825,6 +2825,14 @@ string_input_for_buffer (const char *string)
if (!string)
return NULL;
+ /* a single "/" is not a command */
+ if (strcmp (string, "/") == 0)
+ return string;
+
+ /* "/ " is not a command */
+ if (strncmp (string, "/ ", 2) == 0)
+ return string;
+
/* special case for C comments pasted in input line */
if (strncmp (string, "/*", 2) == 0)
return string;
@@ -2854,9 +2862,13 @@ string_input_for_buffer (const char *string)
next_char = utf8_next_char (string);
- /* there's no next char, then it's a command */
+ /* there's no next char, then it's a not command */
if (!next_char || !next_char[0])
- return NULL;
+ return string;
+
+ /* next char is a space, then it's not a command */
+ if (next_char[0] == ' ')
+ return string;
/* check if first char is doubled: if yes, then it's not a command */
if (utf8_charcmp (string, next_char) == 0)