1
0
Fork 0

Merge pull request #1933 from H3rnand3zzz/fix/wrong-encoding-error-flood-python-plugins

Improve string convertion error handling
This commit is contained in:
Michael Vetter 2023-11-22 12:42:17 +01:00 committed by GitHub
commit 9ef05f4185
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -318,6 +318,11 @@ python_pre_chat_message_display_hook(ProfPlugin* plugin, const char* const barej
{
disable_python_threads();
PyObject* p_args = Py_BuildValue("sss", barejid, resource, message);
if (!p_args) {
log_warning("Unable to convert strings in `python_pre_chat_message_display_hook` to 'UTF8'. barejid: %s, resource: %s, message: %s", barejid, resource, message);
allow_python_threads();
return NULL;
}
PyObject* p_function;
PyObject* p_module = plugin->module;
@ -408,6 +413,12 @@ python_pre_room_message_display_hook(ProfPlugin* plugin, const char* const barej
{
disable_python_threads();
PyObject* p_args = Py_BuildValue("sss", barejid, nick, message);
if (!p_args) {
log_warning("Unable to convert strings in `python_pre_room_message_display_hook` to 'UTF8'. barejid: %s, nick: %s, message: %s", barejid, nick, message);
allow_python_threads();
return NULL;
}
PyObject* p_function;
PyObject* p_module = plugin->module;