diff options
author | Patrick Griffis <tingping@tingping.se> | 2020-09-17 15:50:28 -0700 |
---|---|---|
committer | Patrick Griffis <tingping@tingping.se> | 2020-09-17 15:50:28 -0700 |
commit | 453cb7ca79ace05f53667e523dc534bdeb7ddee0 (patch) | |
tree | 0a29c139d0d769480b6c13a0ccf384b96590862c | |
parent | 163608d7fd861c2c4911a38f45be484c88626bdc (diff) |
Increase max number of words a line can be split into
This may have unintended side-effects but 32 is a very low value and I was seeing real world bugs being caused by this. Specifically an ISUPPORT line with more features than this could store.
-rw-r--r-- | plugins/lua/lua.c | 14 | ||||
-rw-r--r-- | plugins/perl/perl.c | 4 | ||||
-rw-r--r-- | src/common/hexchat.h | 2 | ||||
-rw-r--r-- | src/common/plugin.c | 4 |
4 files changed, 14 insertions, 10 deletions
diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c index 941342bb..8d6b730e 100644 --- a/plugins/lua/lua.c +++ b/plugins/lua/lua.c @@ -35,6 +35,8 @@ #include <hexchat-plugin.h> +#define WORD_ARRAY_LEN 48 + static char plugin_name[] = "Lua"; static char plugin_description[] = "Lua scripting interface"; static char plugin_version[16] = "1.3"; @@ -275,13 +277,13 @@ static int api_command_closure(char *word[], char *word_eol[], void *udata) base = lua_gettop(L); lua_rawgeti(L, LUA_REGISTRYINDEX, info->ref); lua_newtable(L); - for(i = 1; i < 32 && *word_eol[i]; i++) + for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++) { lua_pushstring(L, word[i]); lua_rawseti(L, -2, i); } lua_newtable(L); - for(i = 1; i < 32 && *word_eol[i]; i++) + for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++) { lua_pushstring(L, word_eol[i]); lua_rawseti(L, -2, i); @@ -462,13 +464,13 @@ static int api_server_closure(char *word[], char *word_eol[], void *udata) base = lua_gettop(L); lua_rawgeti(L, LUA_REGISTRYINDEX, info->ref); lua_newtable(L); - for(i = 1; i < 32 && *word_eol[i]; i++) + for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++) { lua_pushstring(L, word[i]); lua_rawseti(L, -2, i); } lua_newtable(L); - for(i = 1; i < 32 && *word_eol[i]; i++) + for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++) { lua_pushstring(L, word_eol[i]); lua_rawseti(L, -2, i); @@ -521,13 +523,13 @@ static int api_server_attrs_closure(char *word[], char *word_eol[], hexchat_even base = lua_gettop(L); lua_rawgeti(L, LUA_REGISTRYINDEX, info->ref); lua_newtable(L); - for(i = 1; i < 32 && *word_eol[i]; i++) + for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++) { lua_pushstring(L, word[i]); lua_rawseti(L, -2, i); } lua_newtable(L); - for(i = 1; i < 32 && *word_eol[i]; i++) + for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++) { lua_pushstring(L, word_eol[i]); lua_rawseti(L, -2, i); diff --git a/plugins/perl/perl.c b/plugins/perl/perl.c index ab06dc96..cb563b38 100644 --- a/plugins/perl/perl.c +++ b/plugins/perl/perl.c @@ -283,6 +283,8 @@ list_item_to_sv ( hexchat_list *list, const char *const *fields ) return sv_2mortal (newRV_noinc ((SV *) hash)); } +#define WORD_ARRAY_LEN 48 + static AV * array2av (char *array[]) { @@ -293,7 +295,7 @@ array2av (char *array[]) for ( count = 1; - count < 32 && array[count] != NULL && array[count][0] != 0; + count < WORD_ARRAY_LEN && array[count] != NULL && array[count][0] != 0; count++ ) { temp = newSVpv (array[count], 0); diff --git a/src/common/hexchat.h b/src/common/hexchat.h index a9e22372..73430f0f 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -75,7 +75,7 @@ #define DOMAINLEN 100 #define NICKLEN 64 /* including the NULL, so 63 really */ #define CHANLEN 300 -#define PDIWORDS 32 +#define PDIWORDS 48 #define USERNAMELEN 10 #define HIDDEN_CHAR 8 /* invisible character for xtext */ diff --git a/src/common/plugin.c b/src/common/plugin.c index 6b2ffd0c..5c09e921 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -662,11 +662,11 @@ plugin_emit_print (session *sess, char *word[], time_t server_time) int plugin_emit_dummy_print (session *sess, char *name) { - char *word[32]; + char *word[PDIWORDS]; int i; word[0] = name; - for (i = 1; i < 32; i++) + for (i = 1; i < PDIWORDS; i++) word[i] = "\000"; return plugin_hook_run (sess, name, word, NULL, NULL, HOOK_PRINT); |