diff options
-rw-r--r-- | ChangeLog.asciidoc | 2 | ||||
-rw-r--r-- | po/cs.po | 10 | ||||
-rw-r--r-- | po/de.po | 10 | ||||
-rw-r--r-- | po/es.po | 10 | ||||
-rw-r--r-- | po/fr.po | 12 | ||||
-rw-r--r-- | po/hu.po | 10 | ||||
-rw-r--r-- | po/it.po | 10 | ||||
-rw-r--r-- | po/ja.po | 32 | ||||
-rw-r--r-- | po/pl.po | 10 | ||||
-rw-r--r-- | po/pt_BR.po | 10 | ||||
-rw-r--r-- | po/ru.po | 10 | ||||
-rw-r--r-- | po/tr.po | 10 | ||||
-rw-r--r-- | po/weechat.pot | 10 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-msg.c | 32 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-msg.h | 4 | ||||
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat-protocol.c | 66 |
16 files changed, 197 insertions, 51 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 1fa8d3012..ffb783291 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -139,6 +139,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * lua: fix interpreter used after unload of a script * perl: fix context used after unload of a script * python: fix interpreter used after unload of a script +* relay: check pointers received in hdata command to prevent crashes with bad + pointers (WeeChat protocol) * relay: remove warning on /reload of relay.conf when ports are defined * relay: fix client disconnection on empty websocket frames received (PONG) * relay: add support of Internet Explorer websocket (closes #73) @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9313,6 +9313,14 @@ msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: nedostatek paměti pro poslouchání na portu" #, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%sChyba: nemohu odpojit klávesu \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s%s: nekorektní znaková sada: \"%s\"" + +#, fuzzy, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "%s%s: selhalo parsování příkazu \"%s\" (prosím oznamte to vývojárům):" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-05-13 23:58+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -10437,6 +10437,14 @@ msgstr "%s: Lausche am Port %d (Relay: %s,%s, Max.: %d Clients)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: Nicht genug Speicher um an einem neuen Port zu lauschen" +#, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%s%s: ungültiger Rückgabewert \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s%s: ungültige Verbindungsadresse \"%s\" für %s" + #, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9609,6 +9609,14 @@ msgstr "%s: escuchando en el puerto %d (repetidor: %s, %s, max %d clientes)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: no hay memoria suficiente para escuchar en un nuevo puerto" +#, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%sError: no se pudo deshacer el atajo \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s%s: set de caracteres inválido: \"%s\"" + #, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "%s%s: falló la ejecución del comando \"%s\" por el cliente %s%s%s" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" -"PO-Revision-Date: 2014-05-13 22:27+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" +"PO-Revision-Date: 2014-05-24 18:04+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -10205,6 +10205,14 @@ msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s : pas assez de mémoire pour écouter sur le nouveau port" #, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%s : pointeur invalide dans le chemin hdata : \"%s\"" + +#, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s : pointeur de tampon invalide dans le message : \"%s %s\"" + +#, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "%s%s : échec d'exécution de la commande \"%s\" pour le client %s%s%s" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8694,6 +8694,14 @@ msgid "%s%s: not enough memory for listening on new port" msgstr "%s nincs elegendő memória új DCC számára\n" #, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%s nem sikerült a(z) \"%s\" billentyűparancsot visszavonni\n" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" + +#, fuzzy, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9776,6 +9776,14 @@ msgstr "%s: in ascolto sulla porta %d (relay: %s, %s, massimo %d client)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: memoria non sufficiente per l'ascolto su una nuova porta" +#, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%sErrore: impossibile rimuovere la combinazione del tasto \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s%s: set di caratter invalido: \"%s\"" + #, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "%s%s: impossibile eseguire il comando \"%s\" per il client %s%s%s" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-05-15 12:40+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" @@ -40,11 +40,11 @@ msgid "max chars" msgstr "最大文字数" msgid "" -"a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)" -"green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal " -"color number or an alias; attributes are allowed before color (for text " -"color only, not background): \"*\" for bold, \"!\" for reverse, \"/\" for " -"italic, \"_\" for underline" +"a WeeChat color name (default, black, (dark)gray, white, (light)red, " +"(light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a " +"terminal color number or an alias; attributes are allowed before color (for " +"text color only, not background): \"*\" for bold, \"!\" for reverse, \"/\" " +"for italic, \"_\" for underline" msgstr "" "WeeChat の色名 (default、black、(dark)gray、white、(light)red、(light)green、" "brown、yellow、(light)blue、(light)magenta、(light)cyan) 、ターミナル色番号ま" @@ -5810,8 +5810,8 @@ msgstr "" " - 内部サーバ名 (/server add で作成されたもの、利用推奨)\n" " - ホスト名/ポート番号、又は IP アドレス/ポート番号 (これは一時的" "サーバを作る)、デフォルトのポート番号は 6667\n" -" - 次のフォーマットに従う URL: irc[6][s]://[nickname[:password]@]" -"irc.example.org[:port][/#channel1][,#channel2[...]]\n" +" - 次のフォーマットに従う URL: irc[6][s]://[nickname[:" +"password]@]irc.example.org[:port][/#channel1][,#channel2[...]]\n" " option: サーバに関するオプション (ブール型オプションでは、value は無視さ" "れる)\n" " nooption: ブール型オプションを 'off' にする (例: -nossl)\n" @@ -9826,6 +9826,14 @@ msgstr "" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: 新しいポートをリッスンするためのメモリ不足" +#, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%s%s: 無効なリターンコード \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%1$s%2$s: %4$s 用に割り当てた不正なアドレス \"%3$s\"" + #, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "" @@ -10683,8 +10691,8 @@ msgid "" "Examples (you can also look at default triggers with /trigger listdefault):\n" " add text attributes *bold*, _underline_ and /italic/ (only in user " "messages):\n" -" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==\\*" -"(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:" +" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==" +"\\*(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:" "underline}$1${color:-underline}_== ==/(\\S+)/==/${color:italic}$1${color:-" "italic}/\"\n" " hide nicklist bar on small terminals:\n" @@ -10758,8 +10766,8 @@ msgstr "" "\n" "例 (/trigger listdefault でデフォルトトリガを見ることができます):\n" " テキスト属性 *太字*、_下線_、/イタリック/ を追加 (ユーザメッセージのみ):\n" -" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==\\*" -"(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:" +" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==" +"\\*(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:" "underline}$1${color:-underline}_== ==/(\\S+)/==/${color:italic}$1${color:-" "italic}/\"\n" " 狭い端末ではニックネームリストバーを隠す:\n" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -9953,6 +9953,14 @@ msgstr "%s: nasłuchuję na porcie %d (relay: %s, %s, max %d klientów)" msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: za mało pamięci do nasłuchu na nowym porcie" +#, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%sBłąd: nie można od bindować klawisza \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s%s: niepoprawny adres powiązania \"%s\" dla %s" + #, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "%s%s: nie udało się wykonać komendy \"%s\" dla klienta %s%s%s" diff --git a/po/pt_BR.po b/po/pt_BR.po index 38db5e303..390a7a7f9 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8956,6 +8956,14 @@ msgid "%s%s: not enough memory for listening on new port" msgstr "%s%s: memória insuficiente para escutar na nova porta" #, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%sErro: não foi possível desassociar a tecla de atalho \"%s\"" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%s%s: charset inválido: \"%s\"" + +#, fuzzy, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "%s%s: falha ao executar comando \"%s\" para cliente %d" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -8719,6 +8719,14 @@ msgid "%s%s: not enough memory for listening on new port" msgstr "%s недостаточно памяти для нового DCC\n" #, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%s не могу отвязать клавишу \"%s\"\n" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "Не могу записать лог-файл \"%s\"\n" + +#, fuzzy, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "Не могу записать лог-файл \"%s\"\n" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7821,6 +7821,14 @@ msgstr "" msgid "%s%s: not enough memory for listening on new port" msgstr "" +#, fuzzy, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "%sHata: dosya \"%s\" oluşturulamaz" + +#, fuzzy, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "%sHata: dosya \"%s\" oluşturulamaz" + #, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index eb0bb0aca..e616b4eb3 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-13 22:26+0200\n" +"POT-Creation-Date: 2014-05-24 18:00+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -7767,6 +7767,14 @@ msgid "%s%s: not enough memory for listening on new port" msgstr "" #, c-format +msgid "%s: invalid pointer in hdata path: \"%s\"" +msgstr "" + +#, c-format +msgid "%s: invalid buffer pointer in message: \"%s %s\"" +msgstr "" + +#, c-format msgid "%s%s: failed to execute command \"%s\" for client %s%s%s" msgstr "" diff --git a/src/plugins/relay/weechat/relay-weechat-msg.c b/src/plugins/relay/weechat/relay-weechat-msg.c index c05aa1e44..0d2bb4809 100644 --- a/src/plugins/relay/weechat/relay-weechat-msg.c +++ b/src/plugins/relay/weechat/relay-weechat-msg.c @@ -541,9 +541,13 @@ relay_weechat_msg_add_hdata_path (struct t_relay_weechat_msg *msg, * * Argument keys is optional: if not NULL, comma-separated list of keys to * return for hdata. + * + * Returns: + * 1: hdata added to message + * 0: error (hdata NOT added to message) */ -void +int relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, const char *path, const char *keys) { @@ -553,9 +557,11 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, const char *hdata_name, *array_size; void *pointer, **path_pointers; long unsigned int value; - int num_keys, num_path, i, type, pos_count, count, rc; + int rc, num_keys, num_path, i, type, pos_count, count, rc_sscanf; uint32_t count32; + rc = 0; + hdata_head = NULL; list_keys = NULL; num_keys = 0; @@ -587,9 +593,23 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, pos[0] = '\0'; if (strncmp (list_path[0], "0x", 2) == 0) { - rc = sscanf (list_path[0], "%lx", &value); - if ((rc != EOF) && (rc != 0)) + rc_sscanf = sscanf (list_path[0], "%lx", &value); + if ((rc_sscanf != EOF) && (rc_sscanf != 0)) + { pointer = (void *)value; + if (!weechat_hdata_check_pointer (ptr_hdata_head, NULL, pointer)) + { + if (weechat_relay_plugin->debug >= 1) + { + weechat_printf (NULL, + _("%s: invalid pointer in hdata path: " + "\"%s\""), + RELAY_PLUGIN_NAME, + path); + } + goto end; + } + } } else pointer = weechat_hdata_get_list (ptr_hdata_head, list_path[0]); @@ -709,6 +729,8 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, count32 = htonl ((uint32_t)count); relay_weechat_msg_set_bytes (msg, pos_count, &count32, 4); + rc = 1; + end: if (list_keys) weechat_string_free_split (list_keys); @@ -720,6 +742,8 @@ end: free (path_returned); if (hdata_head) free (hdata_head); + + return rc; } /* diff --git a/src/plugins/relay/weechat/relay-weechat-msg.h b/src/plugins/relay/weechat/relay-weechat-msg.h index 4b4412d4a..0284563a5 100644 --- a/src/plugins/relay/weechat/relay-weechat-msg.h +++ b/src/plugins/relay/weechat/relay-weechat-msg.h @@ -68,8 +68,8 @@ extern void relay_weechat_msg_add_pointer (struct t_relay_weechat_msg *msg, void *pointer); extern void relay_weechat_msg_add_time (struct t_relay_weechat_msg *msg, time_t time); -extern void relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, - const char *path, const char *keys); +extern int relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg, + const char *path, const char *keys); extern void relay_weechat_msg_add_infolist (struct t_relay_weechat_msg *msg, const char *name, void *pointer, diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c index d95747179..863a9b018 100644 --- a/src/plugins/relay/weechat/relay-weechat-protocol.c +++ b/src/plugins/relay/weechat/relay-weechat-protocol.c @@ -215,9 +215,11 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(hdata) msg = relay_weechat_msg_new (id); if (msg) { - relay_weechat_msg_add_hdata (msg, argv[0], - (argc > 1) ? argv_eol[1] : NULL); - relay_weechat_msg_send (client, msg); + if (relay_weechat_msg_add_hdata (msg, argv[0], + (argc > 1) ? argv_eol[1] : NULL)) + { + relay_weechat_msg_send (client, msg); + } relay_weechat_msg_free (msg); } @@ -311,7 +313,18 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(nicklist) { ptr_buffer = relay_weechat_protocol_get_buffer (argv[0]); if (!ptr_buffer) + { + if (weechat_relay_plugin->debug >= 1) + { + weechat_printf (NULL, + _("%s: invalid buffer pointer in message: " + "\"%s %s\""), + RELAY_PLUGIN_NAME, + command, + argv_eol[0]); + } return WEECHAT_RC_OK; + } } msg = relay_weechat_msg_new (id); @@ -379,26 +392,37 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(input) RELAY_WEECHAT_PROTOCOL_MIN_ARGS(2); ptr_buffer = relay_weechat_protocol_get_buffer (argv[0]); - if (ptr_buffer) + if (!ptr_buffer) { - pos = strchr (argv_eol[0], ' '); - if (pos) + if (weechat_relay_plugin->debug >= 1) { - /* - * use a timer to execute the command after we go back in the - * WeeChat main loop (some commands like /upgrade executed now can - * cause a crash) - */ - timer_args = malloc (2 * sizeof (*timer_args)); - if (timer_args) - { - timer_args[0] = strdup (weechat_buffer_get_string (ptr_buffer, - "full_name")); - timer_args[1] = strdup (pos + 1); - weechat_hook_timer (1, 0, 1, - &relay_weechat_protocol_input_timer_cb, - timer_args); - } + weechat_printf (NULL, + _("%s: invalid buffer pointer in message: " + "\"%s %s\""), + RELAY_PLUGIN_NAME, + command, + argv_eol[0]); + } + return WEECHAT_RC_OK; + } + + pos = strchr (argv_eol[0], ' '); + if (pos) + { + /* + * use a timer to execute the command after we go back in the + * WeeChat main loop (some commands like /upgrade executed now can + * cause a crash) + */ + timer_args = malloc (2 * sizeof (*timer_args)); + if (timer_args) + { + timer_args[0] = strdup (weechat_buffer_get_string (ptr_buffer, + "full_name")); + timer_args[1] = strdup (pos + 1); + weechat_hook_timer (1, 0, 1, + &relay_weechat_protocol_input_timer_cb, + timer_args); } } |