1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 04:05:42 +02:00

api: display warning in scripts when invalid pointers (malformed strings) are given to plugin API functions (warning displayed if debug for plugin is >= 1)

This commit is contained in:
Sebastien Helleu
2012-03-24 13:00:50 +01:00
parent 93ec33d491
commit c4cfd651fc
26 changed files with 1014 additions and 912 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.8-dev, 2012-03-23
v0.3.8-dev, 2012-03-24
Version 0.3.8 (under dev!)
@@ -15,6 +15,8 @@ Version 0.3.8 (under dev!)
weechat.look.paste_bracketed and weechat.look.paste_bracketed_timer_delay
(task #11316)
* core: fix display of wide chars on last column of chat area (patch #7733)
* api: display warning in scripts when invalid pointers (malformed strings) are
given to plugin API functions (warning displayed if debug for plugin is >= 1)
* api: add list "gui_buffer_last_displayed" in hdata "buffer"
* irc: do not send command "MODE #channel" on manual /names (do it only when
names are received on join of channel) (bug #35930)
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7856,6 +7856,11 @@ msgstr ""
"jméno skriptu (může začínat nebo končit \"*\" jako zástupným znakem) "
"(volitelné)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: špatné parametry pro funkci \"%s\" (skript: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr "%s: chyba načítání skriptu \"%s\" (špatné jméno, mezery jsou zakázány)"
+6 -1
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-03-13 16:36+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -8367,6 +8367,11 @@ msgstr ""
"Name des Skripts (darf mit einem \"*\" als Platzhalter beginnen oder enden) "
"(optional)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: Fehlerhafte Argumente für die Funktion \"%s\" (Skript: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8107,6 +8107,11 @@ msgstr ""
"nombre del script (puede empezar o terminar con \"*\" como comodín) "
"(opcional)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: argumentos incorrectos para la función \"%s\" (script: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+9 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"PO-Revision-Date: 2012-03-23 13:29+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-03-24 12:21+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -8171,6 +8171,13 @@ msgstr ""
"nom de script (peut démarrer ou se terminer par \"*\" comme joker) "
"(optionnel)"
#, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr ""
"%s%s: attention, pointeur invalide (\"%s\") pour la fonction \"%s\" (script: "
"%s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7358,6 +7358,11 @@ msgstr ""
msgid "script name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s rossz argumentum a \"%s\" parancsnak\n"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8090,6 +8090,11 @@ msgstr ""
"nome script (può iniziare o terminare con \"*\" come carattere jolly) "
"(opzionale)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: argomenti errati per la funzione \"%s\" (script: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: \"AYANOKOUZI, Ryuunosuke\" <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese\n"
@@ -7897,6 +7897,11 @@ msgid "script name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
"スクリプト名 (ワイルドカードとして \"*\" で始めるか終われる) (オプション)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: 関数 \"%s\" の不正な引数 (スクリプト: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr "%s: スクリプト \"%s\" のロード中にエラー (無効な名前、スペースは禁止)"
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8030,6 +8030,11 @@ msgstr "wskaźnik skryptu (opcjonalne)"
msgid "script name (can start or end with \"*\" as wildcard) (optional)"
msgstr "nazwa skryptu (może się zaczynać lub kończyć \"*\") (opcjonalne)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: nieprawidłowe argumenty dla funkcji \"%s\" (skrypt: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7491,6 +7491,11 @@ msgstr ""
"nome do script (pode começar ou terminar com \"*\" como um coringa) "
"(opcional)"
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s%s: argumentos inválidos para a função \"%s\" (script: %s)"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.8-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: 2012-02-26 09:16+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -7381,6 +7381,11 @@ msgstr ""
msgid "script name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
#, fuzzy, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr "%s некорректные аргументы команды \"%s\"\n"
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
+6 -1
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-03-23 18:09+0100\n"
"POT-Creation-Date: 2012-03-24 12:52+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -6469,6 +6469,11 @@ msgstr ""
msgid "script name (can start or end with \"*\" as wildcard) (optional)"
msgstr ""
#, c-format
msgid ""
"%s%s: warning, invalid pointer (\"%s\") for function \"%s\" (script: %s)"
msgstr ""
#, c-format
msgid "%s: error loading script \"%s\" (bad name, spaces are forbidden)"
msgstr ""
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -367,7 +367,7 @@ weechat_guile_load (const char *filename)
char *filename2, *ptr_base_name, *base_name;
SCM module;
if ((weechat_guile_plugin->debug >= 1) || !guile_quiet)
if ((weechat_guile_plugin->debug >= 2) || !guile_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
@@ -437,7 +437,7 @@ weechat_guile_unload (struct t_plugin_script *script)
{
int *rc;
if ((weechat_guile_plugin->debug >= 1) || !guile_quiet)
if ((weechat_guile_plugin->debug >= 2) || !guile_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -251,7 +251,7 @@ weechat_lua_load (const char *filename)
return 0;
}
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
if ((weechat_lua_plugin->debug >= 2) || !lua_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
@@ -385,7 +385,7 @@ weechat_lua_unload (struct t_plugin_script *script)
int *rc;
void *interpreter;
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
if ((weechat_lua_plugin->debug >= 2) || !lua_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -390,7 +390,7 @@ weechat_perl_load (const char *filename)
return 0;
}
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
if ((weechat_perl_plugin->debug >= 2) || !perl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
@@ -557,7 +557,7 @@ weechat_perl_unload (struct t_plugin_script *script)
int *rc;
void *interpreter;
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
if ((weechat_perl_plugin->debug >= 2) || !perl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -583,7 +583,7 @@ weechat_python_load (const char *filename)
return 0;
}
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
if ((weechat_python_plugin->debug >= 2) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
@@ -767,7 +767,7 @@ weechat_python_unload (struct t_plugin_script *script)
void *interpreter;
PyThreadState *old_interpreter;
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
if ((weechat_python_plugin->debug >= 2) || !python_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -485,7 +485,7 @@ weechat_ruby_load (const char *filename)
return 0;
}
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
if ((weechat_ruby_plugin->debug >= 2) || !ruby_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
@@ -621,7 +621,7 @@ weechat_ruby_unload (struct t_plugin_script *script)
int *rc;
void *interpreter;
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
if ((weechat_ruby_plugin->debug >= 2) || !ruby_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),
+24 -3
View File
@@ -262,18 +262,39 @@ script_ptr2str (void *pointer)
*/
void *
script_str2ptr (const char *pointer_str)
script_str2ptr (struct t_weechat_plugin *weechat_plugin,
const char *script_name, const char *function_name,
const char *str_pointer)
{
long unsigned int value;
int rc;
struct t_gui_buffer *ptr_buffer;
if (!pointer_str || (pointer_str[0] != '0') || (pointer_str[1] != 'x'))
if (!str_pointer || !str_pointer[0])
return NULL;
rc = sscanf (pointer_str + 2, "%lx", &value);
if ((str_pointer[0] != '0') || (str_pointer[1] != 'x'))
goto invalid;
rc = sscanf (str_pointer + 2, "%lx", &value);
if ((rc != EOF) && (rc >= 1))
return (void *)value;
invalid:
if (weechat_plugin->debug >= 1)
{
ptr_buffer = weechat_buffer_search_main ();
if (ptr_buffer)
{
weechat_buffer_set (ptr_buffer, "print_hooks_enabled", "0");
weechat_printf (NULL,
_("%s%s: warning, invalid pointer (\"%s\") for "
"function \"%s\" (script: %s)"),
weechat_prefix ("error"), weechat_plugin->name,
str_pointer, function_name, script_name);
weechat_buffer_set (ptr_buffer, "print_hooks_enabled", "1");
}
}
return NULL;
}
+3 -1
View File
@@ -97,7 +97,9 @@ extern void script_init (struct t_weechat_plugin *weechat_plugin,
extern int script_valid (struct t_plugin_script *scripts,
struct t_plugin_script *script);
extern char *script_ptr2str (void *pointer);
extern void *script_str2ptr (const char *pointer_str);
extern void *script_str2ptr (struct t_weechat_plugin *weechat_plugin,
const char *script_name, const char *function_name,
const char *pointer_str);
extern void script_auto_load (struct t_weechat_plugin *weechat_plugin,
void (*callback)(void *data, const char *filename));
extern struct t_plugin_script *script_search (struct t_weechat_plugin *weechat_plugin,
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -290,7 +290,7 @@ weechat_tcl_load (const char *filename)
return 0;
}
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
if ((weechat_tcl_plugin->debug >= 2) || !tcl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: loading script \"%s\""),
@@ -369,7 +369,7 @@ weechat_tcl_unload (struct t_plugin_script *script)
Tcl_Interp* interp;
int *rc;
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
if ((weechat_tcl_plugin->debug >= 2) || !tcl_quiet)
{
weechat_printf (NULL,
weechat_gettext ("%s: unloading script \"%s\""),