1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

Compare commits

...

18 Commits

Author SHA1 Message Date
Sébastien Helleu 209ffbe50e core: fix buffer overflow in function eval_string_range_chars 2025-05-11 17:10:29 +02:00
Sébastien Helleu 0c9028b47c core: fix buffer overflow in function eval_string_base_encode 2025-05-11 16:11:54 +02:00
Sébastien Helleu fdcab27513 core: fix integer overflow in function util_version_number 2025-05-11 15:59:36 +02:00
Sébastien Helleu 96dc934241 core: fix integer overflow in base32 encoding/decoding 2025-05-11 15:23:22 +02:00
Sébastien Helleu 7f96c31e1b core: fix integer overflow with decimal numbers in calculation of expression 2025-05-11 14:48:17 +02:00
Sébastien Helleu d1c6d170ac core: fix crash in case of NULL message sent to function gui_chat_printf_y_date_tags (issue #1883) 2024-09-08 10:52:48 +02:00
Faisal N Jawdat d0fe9508a5 ruby: add detection for Ruby 3.3 2024-09-08 10:32:38 +02:00
Sébastien Helleu 244ba50841 core: fix test of Debian patches when there are no patches 2024-09-08 09:26:04 +02:00
Sébastien Helleu ec31f43d85 ci: fix macOS CI 2024-09-08 09:25:02 +02:00
Sébastien Helleu 2e10264e96 core: fix Czech translation 2024-09-08 09:09:53 +02:00
Sébastien Helleu ccfe1f2263 core: fix detection of libgcrypt ≥ 1.11 (debian #1071960)
Use pkg-config to detect libgcrypt, since command `libgcrypt-config` is not
available any more.

Remove patches for Debian/Raspbian Buster and Ubuntu Bionic: detection of
libgcrypt don't work any more with version 1.8.4 on Debian Buster and 1.8.1 on
Ubuntu Bionic (both versions don't provide the file `libgcrypt.pc`).
2024-09-08 09:09:53 +02:00
Sébastien Helleu 3ece5bd8a9 core: update ChangeLog (issue #2178) 2024-09-08 09:09:53 +02:00
Sébastien Helleu 4a63d88895 trigger: fix integer overflow in loop (issue #2178) 2024-09-08 09:09:53 +02:00
Sébastien Helleu 9a0bd7c753 relay: fix integer overflow in loops (issue #2178) 2024-09-08 09:09:53 +02:00
Sébastien Helleu d8c954472c irc: fix integer overflow in loops (issue #2178) 2024-09-08 09:09:53 +02:00
Sébastien Helleu 64eee892b2 core: fix integer overflow in loops (issue #2178) 2024-09-08 09:09:53 +02:00
Yiheng Cao d1655945cd core: fix integer overflow in string_free_split functions (issue #2178) 2024-09-08 08:29:47 +02:00
Sébastien Helleu d2f78e2248 Version 3.8.1-dev 2024-09-08 08:29:31 +02:00
33 changed files with 234 additions and 351 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
brew update brew update
brew install asciidoctor lua ruby brew install asciidoctor guile lua ruby
- name: Build - name: Build
env: env:
+3 -2
View File
@@ -184,9 +184,10 @@ if(ENABLE_NLS)
endif() endif()
# Check for libgcrypt # Check for libgcrypt
find_package(GCRYPT REQUIRED) pkg_check_modules(LIBGCRYPT REQUIRED libgcrypt)
add_definitions(-DHAVE_GCRYPT) add_definitions(-DHAVE_GCRYPT)
list(APPEND EXTRA_LIBS ${GCRYPT_LDFLAGS}) include_directories(${LIBGCRYPT_INCLUDE_DIRS})
list(APPEND EXTRA_LIBS ${LIBGCRYPT_LDFLAGS})
# Check for GnuTLS # Check for GnuTLS
find_package(GnuTLS REQUIRED) find_package(GnuTLS REQUIRED)
+18
View File
@@ -15,6 +15,24 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
(file _ReleaseNotes.adoc_ in sources). (file _ReleaseNotes.adoc_ in sources).
[[v3.8.1]]
== Version 3.8.1 (under dev)
Bug fixes::
* core: fix buffer overflow in function eval_string_range_chars
* core: fix buffer overflow in function eval_string_base_encode
* core: fix integer overflow in function util_version_number
* core: fix integer overflow in base32 encoding/decoding
* core: fix integer overflow with decimal numbers in calculation of expression
* core, plugins: fix integer overflow in loops (issue #2178)
* core: fix crash in case of NULL message sent to function gui_chat_printf_y_date_tags (issue #1883)
Build::
* core: fix detection of libgcrypt ≥ 1.11 (debian #1071960)
* ruby: add detection of Ruby 3.3
[[v3.8]] [[v3.8]]
== Version 3.8 (2023-01-08) == Version 3.8 (2023-01-08)
-53
View File
@@ -1,53 +0,0 @@
#
# Copyright (C) 2003-2023 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of WeeChat, the extensible chat client.
#
# WeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# WeeChat is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
# - Find Gcrypt
# This module finds if libgcrypt is installed and determines where
# the include files and libraries are.
#
# This code sets the following variables:
#
# GCRYPT_CFLAGS = cflags to use to compile
# GCRYPT_LDFLAGS = ldflags to use to compile
#
find_program(LIBGCRYPT_CONFIG_EXECUTABLE NAMES libgcrypt-config)
set(GCRYPT_LDFLAGS)
set(GCRYPT_CFLAGS)
if(LIBGCRYPT_CONFIG_EXECUTABLE)
execute_process(COMMAND ${LIBGCRYPT_CONFIG_EXECUTABLE} --libs RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE GCRYPT_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
execute_process(COMMAND ${LIBGCRYPT_CONFIG_EXECUTABLE} --cflags RESULT_VARIABLE _return_VALUE OUTPUT_VARIABLE GCRYPT_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if(NOT DEFINED ${GCRYPT_CFLAGS})
set(GCRYPT_CFLAGS " ")
endif()
endif()
# handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GCRYPT REQUIRED_VARS GCRYPT_LDFLAGS GCRYPT_CFLAGS)
if(GCRYPT_FOUND)
mark_as_advanced(GCRYPT_CFLAGS GCRYPT_LDFLAGS)
endif()
+1 -1
View File
@@ -37,7 +37,7 @@ if(PKG_CONFIG_FOUND)
# set specific search path for macOS # set specific search path for macOS
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/ruby/lib/pkgconfig") set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/ruby/lib/pkgconfig")
endif() endif()
pkg_search_module(RUBY ruby-3.2 ruby-3.1 ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ruby-2.4 ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9 ruby) pkg_search_module(RUBY ruby-3.3 ruby-3.2 ruby-3.1 ruby-3.0 ruby-2.7 ruby-2.6 ruby-2.5 ruby-2.4 ruby-2.3 ruby-2.2 ruby-2.1 ruby-2.0 ruby-1.9 ruby)
if(RUBY_FOUND AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(RUBY_FOUND AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# FIXME: weird hack: hardcoding the Ruby lib location on macOS # FIXME: weird hack: hardcoding the Ruby lib location on macOS
set(RUBY_LDFLAGS "${RUBY_LDFLAGS} -L/usr/local/opt/ruby/lib") set(RUBY_LDFLAGS "${RUBY_LDFLAGS} -L/usr/local/opt/ruby/lib")
+2 -2
View File
@@ -22,7 +22,7 @@ msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2022-12-29 11:51+0100\n" "POT-Creation-Date: 2022-12-29 11:51+0100\n"
"PO-Revision-Date: 2022-10-15 22:51+0200\n" "PO-Revision-Date: 2024-09-08 09:08+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: cs\n" "Language: cs\n"
@@ -144,7 +144,7 @@ msgstr ""
#, c-format #, c-format
msgid "End of command '%s', timeout reached (%.1fs)" msgid "End of command '%s', timeout reached (%.1fs)"
msgstr "Konec příkazu '%s', vypršel časový limit (%.lfs)" msgstr "Konec příkazu '%s', vypršel časový limit (%.1fs)"
#, c-format #, c-format
msgid "System clock skew detected (%+ld seconds), reinitializing all timers" msgid "System clock skew detected (%+ld seconds), reinitializing all timers"
+4 -5
View File
@@ -269,6 +269,7 @@ hook_line_add_to_infolist (struct t_infolist_item *item,
void void
hook_line_print_log (struct t_hook *hook) hook_line_print_log (struct t_hook *hook)
{ {
char **ptr_tag;
int i, j; int i, j;
if (!hook || !hook->hook_data) if (!hook || !hook->hook_data)
@@ -290,12 +291,10 @@ hook_line_print_log (struct t_hook *hook)
{ {
for (i = 0; i < HOOK_LINE(hook, tags_count); i++) for (i = 0; i < HOOK_LINE(hook, tags_count); i++)
{ {
for (j = 0; HOOK_LINE(hook, tags_array)[i][j]; j++) for (ptr_tag = HOOK_LINE(hook, tags_array)[i], j = 0; *ptr_tag;
ptr_tag++, j++)
{ {
log_printf (" tags_array[%03d][%03d]: '%s'", log_printf (" tags_array[%03d][%03d]: '%s'", i, j, *ptr_tag);
i,
j,
HOOK_LINE(hook, tags_array)[i][j]);
} }
} }
} }
+4 -5
View File
@@ -249,6 +249,7 @@ hook_print_add_to_infolist (struct t_infolist_item *item,
void void
hook_print_print_log (struct t_hook *hook) hook_print_print_log (struct t_hook *hook)
{ {
char **ptr_tag;
int i, j; int i, j;
if (!hook || !hook->hook_data) if (!hook || !hook->hook_data)
@@ -263,12 +264,10 @@ hook_print_print_log (struct t_hook *hook)
{ {
for (i = 0; i < HOOK_PRINT(hook, tags_count); i++) for (i = 0; i < HOOK_PRINT(hook, tags_count); i++)
{ {
for (j = 0; HOOK_PRINT(hook, tags_array)[i][j]; j++) for (ptr_tag = HOOK_PRINT(hook, tags_array)[i], j = 0; *ptr_tag;
ptr_tag++, j++)
{ {
log_printf (" tags_array[%03d][%03d]: '%s'", log_printf (" tags_array[%03d][%03d]: '%s'", i, j, *ptr_tag);
i,
j,
HOOK_PRINT(hook, tags_array)[i][j]);
} }
} }
} }
+4 -3
View File
@@ -213,7 +213,7 @@ hook_process (struct t_weechat_plugin *plugin,
void void
hook_process_child (struct t_hook *hook_process) hook_process_child (struct t_hook *hook_process)
{ {
char **exec_args, *arg0, str_arg[64]; char **exec_args, *arg0, str_arg[64], **ptr_exec_arg;
const char *ptr_url, *ptr_arg; const char *ptr_url, *ptr_arg;
int rc, i, num_args; int rc, i, num_args;
FILE *f; FILE *f;
@@ -353,9 +353,10 @@ hook_process_child (struct t_hook *hook_process)
{ {
log_printf ("hook_process, command='%s'", log_printf ("hook_process, command='%s'",
HOOK_PROCESS(hook_process, command)); HOOK_PROCESS(hook_process, command));
for (i = 0; exec_args[i]; i++) for (ptr_exec_arg = exec_args, i = 0; *ptr_exec_arg;
ptr_exec_arg++, i++)
{ {
log_printf (" args[%02d] == '%s'", i, exec_args[i]); log_printf (" args[%d] == '%s'", i, *ptr_exec_arg);
} }
} }
execvp (exec_args[0], exec_args); execvp (exec_args[0], exec_args);
+26 -25
View File
@@ -334,10 +334,11 @@ char *
calc_expression (const char *expr) calc_expression (const char *expr)
{ {
struct t_arraylist *list_values, *list_ops; struct t_arraylist *list_values, *list_ops;
const char *ptr_expr, *ptr_expr2;
char str_result[64], *ptr_operator, *operator; char str_result[64], *ptr_operator, *operator;
int i, i2, index_op, decimals; int index_op;
enum t_calc_symbol last_symbol; enum t_calc_symbol last_symbol;
double value, factor, *ptr_value; double value, factor, decimals, *ptr_value;
list_values = NULL; list_values = NULL;
list_ops = NULL; list_ops = NULL;
@@ -363,21 +364,21 @@ calc_expression (const char *expr)
goto end; goto end;
last_symbol = CALC_SYMBOL_NONE; last_symbol = CALC_SYMBOL_NONE;
for (i = 0; expr[i]; i++) for (ptr_expr = expr; ptr_expr[0]; ptr_expr++)
{ {
if (expr[i] == ' ') if (ptr_expr[0] == ' ')
{ {
/* ignore spaces */ /* ignore spaces */
continue; continue;
} }
else if (expr[i] == '(') else if (ptr_expr[0] == '(')
{ {
ptr_operator = string_strndup (expr + i, 1); ptr_operator = string_strndup (ptr_expr, 1);
arraylist_add (list_ops, ptr_operator); arraylist_add (list_ops, ptr_operator);
last_symbol = CALC_SYMBOL_PARENTHESIS_OPEN; last_symbol = CALC_SYMBOL_PARENTHESIS_OPEN;
} }
else if (isdigit ((unsigned char)expr[i]) || (expr[i] == '.') else if (isdigit ((unsigned char)ptr_expr[0]) || (ptr_expr[0] == '.')
|| ((expr[i] == '-') || ((ptr_expr[0] == '-')
&& ((last_symbol == CALC_SYMBOL_NONE) && ((last_symbol == CALC_SYMBOL_NONE)
|| (last_symbol == CALC_SYMBOL_PARENTHESIS_OPEN) || (last_symbol == CALC_SYMBOL_PARENTHESIS_OPEN)
|| (last_symbol == CALC_SYMBOL_OPERATOR)))) || (last_symbol == CALC_SYMBOL_OPERATOR))))
@@ -385,15 +386,15 @@ calc_expression (const char *expr)
value = 0; value = 0;
decimals = 0; decimals = 0;
factor = 1; factor = 1;
if (expr[i] == '-') if (ptr_expr[0] == '-')
{ {
factor = -1; factor = -1;
i++; ptr_expr++;
} }
while (expr[i] while (ptr_expr[0]
&& (isdigit ((unsigned char)expr[i]) || (expr[i] == '.'))) && (isdigit ((unsigned char)ptr_expr[0]) || (ptr_expr[0] == '.')))
{ {
if (expr[i] == '.') if (ptr_expr[0] == '.')
{ {
if (decimals == 0) if (decimals == 0)
decimals = 10; decimals = 10;
@@ -402,24 +403,24 @@ calc_expression (const char *expr)
{ {
if (decimals) if (decimals)
{ {
value = value + (((double)(expr[i] - '0')) / decimals); value = value + (((double)(ptr_expr[0] - '0')) / decimals);
decimals *= 10; decimals *= 10;
} }
else else
{ {
value = (value * 10) + (expr[i] - '0'); value = (value * 10) + (ptr_expr[0] - '0');
} }
} }
i++; ptr_expr++;
} }
i--; ptr_expr--;
value *= factor; value *= factor;
ptr_value = malloc (sizeof (value)); ptr_value = malloc (sizeof (value));
*ptr_value = value; *ptr_value = value;
arraylist_add (list_values, ptr_value); arraylist_add (list_values, ptr_value);
last_symbol = CALC_SYMBOL_VALUE; last_symbol = CALC_SYMBOL_VALUE;
} }
else if (expr[i] == ')') else if (ptr_expr[0] == ')')
{ {
index_op = arraylist_size (list_ops) - 1; index_op = arraylist_size (list_ops) - 1;
while (index_op >= 0) while (index_op >= 0)
@@ -439,15 +440,15 @@ calc_expression (const char *expr)
else else
{ {
/* operator */ /* operator */
i2 = i + 1; ptr_expr2 = ptr_expr + 1;
while (expr[i2] && (expr[i2] != ' ') && (expr[i2] != '(') while (ptr_expr2[0] && (ptr_expr2[0] != ' ') && (ptr_expr2[0] != '(')
&& (expr[i2] != ')') && (expr[i2] != '.') && (ptr_expr2[0] != ')') && (ptr_expr2[0] != '.')
&& (expr[i2] != '-') && !isdigit ((unsigned char)expr[i2])) && (ptr_expr2[0] != '-') && !isdigit ((unsigned char)ptr_expr2[0]))
{ {
i2++; ptr_expr2++;
} }
operator = string_strndup (expr + i, i2 - i); operator = string_strndup (ptr_expr, ptr_expr2 - ptr_expr);
i = i2 - 1; ptr_expr = ptr_expr2 - 1;
if (operator) if (operator)
{ {
index_op = arraylist_size (list_ops) - 1; index_op = arraylist_size (list_ops) - 1;
+6 -6
View File
@@ -2147,7 +2147,7 @@ command_eval_print_debug (const char *debug)
COMMAND_CALLBACK(eval) COMMAND_CALLBACK(eval)
{ {
int i, print_only, split_command, condition, debug, error; int i, print_only, split_command, condition, debug, error;
char *result, *ptr_args, **commands, str_debug[32]; char *result, *ptr_args, **commands, **ptr_command, str_debug[32];
const char *debug_output; const char *debug_output;
struct t_hashtable *pointers, *options; struct t_hashtable *pointers, *options;
@@ -2264,9 +2264,9 @@ COMMAND_CALLBACK(eval)
commands = string_split_command (ptr_args, ';'); commands = string_split_command (ptr_args, ';');
if (commands) if (commands)
{ {
for (i = 0; commands[i]; i++) for (ptr_command = commands; *ptr_command; ptr_command++)
{ {
result = eval_expression (commands[i], pointers, NULL, result = eval_expression (*ptr_command, pointers, NULL,
options); options);
if (result) if (result)
{ {
@@ -6253,7 +6253,7 @@ command_set_display_option_lists (char **argv, int arg_start, int arg_end,
COMMAND_CALLBACK(set) COMMAND_CALLBACK(set)
{ {
char *value; char *value, **ptr_environ;
const char *ptr_string; const char *ptr_string;
int i, number_found, rc, display_only_changed, arg_option_start; int i, number_found, rc, display_only_changed, arg_option_start;
int arg_option_end, list_size; int arg_option_end, list_size;
@@ -6275,9 +6275,9 @@ COMMAND_CALLBACK(set)
list = weelist_new (); list = weelist_new ();
if (!list) if (!list)
COMMAND_ERROR; COMMAND_ERROR;
for (i = 0; environ[i]; i++) for (ptr_environ = environ; *ptr_environ; ptr_environ++)
{ {
weelist_add (list, environ[i], WEECHAT_LIST_POS_SORT, NULL); weelist_add (list, *ptr_environ, WEECHAT_LIST_POS_SORT, NULL);
} }
list_size = weelist_size (list); list_size = weelist_size (list);
for (i = 0; i < list_size; i++) for (i = 0; i < list_size; i++)
+9 -9
View File
@@ -1318,9 +1318,9 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
struct t_gui_completion *completion) struct t_gui_completion *completion)
{ {
char *pos_space, *option_full_name, *pos_section, *pos_option; char *pos_space, *option_full_name, *pos_section, *pos_option;
char *file, *section, *value_string; char *file, *section, *value_string, **ptr_value;
const char *color_name; const char *color_name;
int length, i; int length;
struct t_config_file *ptr_config; struct t_config_file *ptr_config;
struct t_config_section *ptr_section, *section_found; struct t_config_section *ptr_section, *section_found;
struct t_config_option *option_found; struct t_config_option *option_found;
@@ -1401,10 +1401,11 @@ completion_list_add_config_option_values_cb (const void *pointer, void *data,
case CONFIG_OPTION_TYPE_INTEGER: case CONFIG_OPTION_TYPE_INTEGER:
if (option_found->string_values) if (option_found->string_values)
{ {
for (i = 0; option_found->string_values[i]; i++) for (ptr_value = option_found->string_values;
*ptr_value; ptr_value++)
{ {
gui_completion_list_add (completion, gui_completion_list_add (completion,
option_found->string_values[i], *ptr_value,
0, WEECHAT_LIST_POS_SORT); 0, WEECHAT_LIST_POS_SORT);
} }
gui_completion_list_add (completion, "++1", gui_completion_list_add (completion, "++1",
@@ -1884,8 +1885,7 @@ completion_list_add_env_vars_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer, struct t_gui_buffer *buffer,
struct t_gui_completion *completion) struct t_gui_completion *completion)
{ {
int i; char *pos, *name, **ptr_environ;
char *pos, *name;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -1893,12 +1893,12 @@ completion_list_add_env_vars_cb (const void *pointer, void *data,
(void) completion_item; (void) completion_item;
(void) buffer; (void) buffer;
for (i = 0; environ[i]; i++) for (ptr_environ = environ; *ptr_environ; ptr_environ++)
{ {
pos = strchr (environ[i], '='); pos = strchr (*ptr_environ, '=');
if (pos) if (pos)
{ {
name = string_strndup (environ[i], pos - environ[i]); name = string_strndup (*ptr_environ, pos - *ptr_environ);
if (name) if (name)
{ {
gui_completion_list_add (completion, name, gui_completion_list_add (completion, name,
+5 -6
View File
@@ -893,8 +893,7 @@ void
config_change_emphasized_attributes (const void *pointer, void *data, config_change_emphasized_attributes (const void *pointer, void *data,
struct t_config_option *option) struct t_config_option *option)
{ {
int i; const char *ptr_attributes, *ptr_attr;
const char *ptr_attr;
/* make C compiler happy */ /* make C compiler happy */
(void) pointer; (void) pointer;
@@ -903,12 +902,12 @@ config_change_emphasized_attributes (const void *pointer, void *data,
config_emphasized_attributes = 0; config_emphasized_attributes = 0;
ptr_attr = CONFIG_STRING(config_look_emphasized_attributes); ptr_attributes = CONFIG_STRING(config_look_emphasized_attributes);
if (ptr_attr) if (ptr_attributes)
{ {
for (i = 0; ptr_attr[i]; i++) for (ptr_attr = ptr_attributes; *ptr_attr; ptr_attr++)
{ {
config_emphasized_attributes |= gui_color_attr_get_flag (ptr_attr[i]); config_emphasized_attributes |= gui_color_attr_get_flag (*ptr_attr);
} }
} }
+19 -12
View File
@@ -299,6 +299,9 @@ eval_string_range_chars (const char *range)
string = NULL; string = NULL;
result = NULL; result = NULL;
if (!range || !range[0])
goto end;
for (i = 0; eval_range_chars[i][0]; i++) for (i = 0; eval_range_chars[i][0]; i++)
{ {
if (strcmp (range, eval_range_chars[i][0]) == 0) if (strcmp (range, eval_range_chars[i][0]) == 0)
@@ -308,11 +311,15 @@ eval_string_range_chars (const char *range)
char1 = utf8_char_int (range); char1 = utf8_char_int (range);
/* next char must be '-' */ /* next char must be '-' */
if (!range[0])
goto end;
ptr_char = utf8_next_char (range); ptr_char = utf8_next_char (range);
if (!ptr_char || !ptr_char[0] || (ptr_char[0] != '-')) if (!ptr_char || !ptr_char[0] || (ptr_char[0] != '-'))
goto end; goto end;
/* next char is the char2 */ /* next char is the char2 */
if (!range[0])
goto end;
ptr_char = utf8_next_char (ptr_char); ptr_char = utf8_next_char (ptr_char);
if (!ptr_char || !ptr_char[0]) if (!ptr_char || !ptr_char[0])
goto end; goto end;
@@ -506,8 +513,8 @@ char *
eval_string_split (const char *text) eval_string_split (const char *text)
{ {
char *pos, *pos2, *pos3, *str_number, *separators, **items, *value, *error; char *pos, *pos2, *pos3, *str_number, *separators, **items, *value, *error;
char str_value[32], *str_flags, **list_flags, *strip_items; char str_value[32], *str_flags, **list_flags, *strip_items, **ptr_flag;
int i, num_items, count_items, random_item, flags; int num_items, count_items, random_item, flags;
long number, max_items; long number, max_items;
str_number = NULL; str_number = NULL;
@@ -563,25 +570,25 @@ eval_string_split (const char *text)
list_flags = string_split (str_flags, "+", NULL, 0, 0, NULL); list_flags = string_split (str_flags, "+", NULL, 0, 0, NULL);
if (list_flags) if (list_flags)
{ {
for (i = 0; list_flags[i]; i++) for (ptr_flag = list_flags; *ptr_flag; ptr_flag++)
{ {
if (strcmp (list_flags[i], "strip_left") == 0) if (strcmp (*ptr_flag, "strip_left") == 0)
flags |= WEECHAT_STRING_SPLIT_STRIP_LEFT; flags |= WEECHAT_STRING_SPLIT_STRIP_LEFT;
else if (strcmp (list_flags[i], "strip_right") == 0) else if (strcmp (*ptr_flag, "strip_right") == 0)
flags |= WEECHAT_STRING_SPLIT_STRIP_RIGHT; flags |= WEECHAT_STRING_SPLIT_STRIP_RIGHT;
else if (strcmp (list_flags[i], "collapse_seps") == 0) else if (strcmp (*ptr_flag, "collapse_seps") == 0)
flags |= WEECHAT_STRING_SPLIT_COLLAPSE_SEPS; flags |= WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
else if (strcmp (list_flags[i], "keep_eol") == 0) else if (strcmp (*ptr_flag, "keep_eol") == 0)
flags |= WEECHAT_STRING_SPLIT_KEEP_EOL; flags |= WEECHAT_STRING_SPLIT_KEEP_EOL;
else if (strncmp (list_flags[i], "strip_items=", 12) == 0) else if (strncmp (*ptr_flag, "strip_items=", 12) == 0)
{ {
if (strip_items) if (strip_items)
free (strip_items); free (strip_items);
strip_items = strdup (list_flags[i] + 12); strip_items = strdup (*ptr_flag + 12);
} }
else if (strncmp (list_flags[i], "max_items=", 10) == 0) else if (strncmp (*ptr_flag, "max_items=", 10) == 0)
{ {
max_items = strtol (list_flags[i] + 10, &error, 10); max_items = strtol (*ptr_flag + 10, &error, 10);
if (!error || error[0] || (max_items < 0)) if (!error || error[0] || (max_items < 0))
goto end; goto end;
} }
@@ -906,7 +913,7 @@ eval_string_base_encode (const char *text)
ptr_string++; ptr_string++;
length = strlen (ptr_string); length = strlen (ptr_string);
result = malloc ((length * 4) + 1); result = malloc ((length * 4) + 8 + 1);
if (!result) if (!result)
goto end; goto end;
+33 -48
View File
@@ -929,20 +929,20 @@ string_match (const char *string, const char *mask, int case_sensitive)
int int
string_match_list (const char *string, const char **masks, int case_sensitive) string_match_list (const char *string, const char **masks, int case_sensitive)
{ {
int match, i; int match;
const char *ptr_mask; const char **ptr_mask, *ptr_mask2;
if (!string || !masks) if (!string || !masks)
return 0; return 0;
match = 0; match = 0;
for (i = 0; masks[i]; i++) for (ptr_mask = masks; *ptr_mask; ptr_mask++)
{ {
ptr_mask = (masks[i][0] == '!') ? masks[i] + 1 : masks[i]; ptr_mask2 = ((*ptr_mask)[0] == '!') ? *ptr_mask + 1 : *ptr_mask;
if (string_match (string, ptr_mask, case_sensitive)) if (string_match (string, ptr_mask2, case_sensitive))
{ {
if (masks[i][0] == '!') if ((*ptr_mask)[0] == '!')
return 0; return 0;
else else
match = 1; match = 1;
@@ -2684,12 +2684,12 @@ string_split_shell (const char *string, int *num_items)
void void
string_free_split (char **split_string) string_free_split (char **split_string)
{ {
int i; char **ptr;
if (split_string) if (split_string)
{ {
for (i = 0; split_string[i]; i++) for (ptr = split_string; *ptr; ptr++)
free (split_string[i]); free (*ptr);
free (split_string); free (split_string);
} }
} }
@@ -2701,12 +2701,12 @@ string_free_split (char **split_string)
void void
string_free_split_shared (char **split_string) string_free_split_shared (char **split_string)
{ {
int i; char **ptr;
if (split_string) if (split_string)
{ {
for (i = 0; split_string[i]; i++) for (ptr = split_string; *ptr; ptr++)
string_shared_free (split_string[i]); string_shared_free (*ptr);
free (split_string); free (split_string);
} }
} }
@@ -2726,8 +2726,9 @@ string_rebuild_split_string (const char **split_string,
const char *separator, const char *separator,
int index_start, int index_end) int index_start, int index_end)
{ {
int i, length, length_separator; const char **ptr_string;
char *result; char **result;
int i;
if (!split_string || (index_start < 0) if (!split_string || (index_start < 0)
|| ((index_end >= 0) && (index_end < index_start))) || ((index_end >= 0) && (index_end < index_start)))
@@ -2735,39 +2736,23 @@ string_rebuild_split_string (const char **split_string,
return NULL; return NULL;
} }
length = 0; result = string_dyn_alloc (256);
length_separator = (separator) ? strlen (separator) : 0;
for (i = 0; split_string[i]; i++) for (ptr_string = split_string, i = 0; *ptr_string; ptr_string++, i++)
{ {
if ((index_end >= 0) && (i > index_end)) if ((index_end >= 0) && (i > index_end))
break; break;
if (i >= index_start) if (i >= index_start)
length += strlen (split_string[i]) + length_separator;
}
if (length == 0)
return strdup ("");
result = malloc (length + 1);
if (!result)
return NULL;
result[0] = '\0';
for (i = index_start; split_string[i]; i++)
{
if ((index_end >= 0) && (i > index_end))
break;
strcat (result, split_string[i]);
if (separator && ((index_end < 0) || (i + 1 <= index_end))
&& split_string[i + 1])
{ {
strcat (result, separator); if (i > index_start)
string_dyn_concat (result, separator, -1);
string_dyn_concat (result, *ptr_string, -1);
} }
if (i == INT_MAX)
break;
} }
return result; return string_dyn_free (result, 0);
} }
/* /*
@@ -2869,12 +2854,12 @@ string_split_command (const char *command, char separator)
void void
string_free_split_command (char **split_command) string_free_split_command (char **split_command)
{ {
int i; char **ptr;
if (split_command) if (split_command)
{ {
for (i = 0; split_command[i]; i++) for (ptr = split_command; *ptr; ptr++)
free (split_command[i]); free (*ptr);
free (split_command); free (split_command);
} }
} }
@@ -2939,14 +2924,12 @@ string_split_tags (const char *tags, int *num_tags)
void void
string_free_split_tags (char ***split_tags) string_free_split_tags (char ***split_tags)
{ {
int i; char ***ptr;
if (split_tags) if (split_tags)
{ {
for (i = 0; split_tags[i]; i++) for (ptr = split_tags; *ptr; ptr++)
{ string_free_split_shared (*ptr);
string_free_split_shared (split_tags[i]);
}
free (split_tags); free (split_tags);
} }
} }
@@ -3433,7 +3416,8 @@ int
string_base32_encode (const char *from, int length, char *to) string_base32_encode (const char *from, int length, char *to)
{ {
unsigned char base32_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; unsigned char base32_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
int count, value, next, bits_left, pad, index; unsigned int value;
int count, next, bits_left, pad, index;
int length_padding[8] = { 0, 0, 6, 0, 4, 3, 0, 2 }; int length_padding[8] = { 0, 0, 6, 0, 4, 3, 0, 2 };
if (!from || !to) if (!from || !to)
@@ -3511,7 +3495,8 @@ int
string_base32_decode (const char *from, char *to) string_base32_decode (const char *from, char *to)
{ {
const char *ptr_from; const char *ptr_from;
int value, bits_left, count; int bits_left, count;
unsigned int value;
unsigned char c; unsigned char c;
if (!from || !to) if (!from || !to)
+3 -1
View File
@@ -469,7 +469,9 @@ util_version_number (const char *version)
{ {
if (number < 0) if (number < 0)
number = 0; number = 0;
else if (number > 0xFF) else if ((i == 0) && (number > 0x7F))
number = 0x7F;
else if ((i > 0) && (number > 0xFF))
number = 0xFF; number = 0xFF;
version_int[i] = number; version_int[i] = number;
} }
+7 -6
View File
@@ -705,7 +705,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
char **content, str_reinit_color[32]; char **content, str_reinit_color[32];
char str_reinit_color_space[32], str_reinit_color_space_start_line[32]; char str_reinit_color_space[32], str_reinit_color_space_start_line[32];
char str_start_item[32]; char str_start_item[32];
char *item_value, *item_value2, ****split_items, **linear_items; char *item_value, *item_value2, ****split_items, **linear_items, **ptr_item;
int i, j, k, sub, index; int i, j, k, sub, index;
int at_least_one_item, first_sub_item; int at_least_one_item, first_sub_item;
int length_reinit_color, length_reinit_color_space, length_start_item; int length_reinit_color, length_reinit_color_space, length_start_item;
@@ -860,15 +860,15 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS, | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, 0,
NULL); NULL);
for (j = 0; split_items[i][sub][j]; j++) for (ptr_item = split_items[i][sub]; *ptr_item; ptr_item++)
{ {
total_items++; total_items++;
length = strlen (split_items[i][sub][j]); length = strlen (*ptr_item);
if (length > max_length) if (length > max_length)
max_length = length; max_length = length;
length = gui_chat_strlen_screen (split_items[i][sub][j]); length = gui_chat_strlen_screen (*ptr_item);
if (length > max_length_screen) if (length > max_length_screen)
max_length_screen = length; max_length_screen = length;
} }
@@ -915,9 +915,10 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
{ {
if (split_items[i][sub]) if (split_items[i][sub])
{ {
for (j = 0; split_items[i][sub][j]; j++) for (ptr_item = split_items[i][sub]; *ptr_item;
ptr_item++)
{ {
linear_items[index++] = split_items[i][sub][j]; linear_items[index++] = *ptr_item;
} }
} }
} }
+3
View File
@@ -906,6 +906,9 @@ gui_chat_printf_y_date_tags (struct t_gui_buffer *buffer, int y, time_t date,
time_t date_printed; time_t date_printed;
int i, last_y, num_lines_to_add; int i, last_y, num_lines_to_add;
if (!message)
return;
if (gui_init_ok && !gui_chat_buffer_valid (buffer, GUI_BUFFER_TYPE_FREE)) if (gui_init_ok && !gui_chat_buffer_valid (buffer, GUI_BUFFER_TYPE_FREE))
return; return;
+12 -12
View File
@@ -1046,9 +1046,9 @@ gui_key_focus_command (const char *key, int context,
struct t_hashtable **hashtable_focus) struct t_hashtable **hashtable_focus)
{ {
struct t_gui_key *ptr_key; struct t_gui_key *ptr_key;
int i, matching, debug, rc; int matching, debug, rc;
unsigned long value; unsigned long value;
char *command, **commands; char *command, **commands, **ptr_command;
const char *str_buffer; const char *str_buffer;
struct t_hashtable *hashtable; struct t_hashtable *hashtable;
struct t_weelist *list_keys; struct t_weelist *list_keys;
@@ -1134,25 +1134,25 @@ gui_key_focus_command (const char *key, int context,
commands = string_split_command (ptr_key->command, ';'); commands = string_split_command (ptr_key->command, ';');
if (commands) if (commands)
{ {
for (i = 0; commands[i]; i++) for (ptr_command = commands; *ptr_command; ptr_command++)
{ {
if (string_strncasecmp (commands[i], "hsignal:", 8) == 0) if (string_strncasecmp (*ptr_command, "hsignal:", 8) == 0)
{ {
if (commands[i][8]) if ((*ptr_command)[8])
{ {
if (debug) if (debug)
{ {
gui_chat_printf (NULL, gui_chat_printf (NULL,
_("Sending hsignal: \"%s\""), _("Sending hsignal: \"%s\""),
commands[i] + 8); *ptr_command + 8);
} }
(void) hook_hsignal_send (commands[i] + 8, (void) hook_hsignal_send (*ptr_command + 8,
hashtable); hashtable);
} }
} }
else else
{ {
command = eval_expression (commands[i], NULL, command = eval_expression (*ptr_command, NULL,
hashtable, NULL); hashtable, NULL);
if (command) if (command)
{ {
@@ -1293,9 +1293,9 @@ gui_key_is_complete (const char *key)
int int
gui_key_pressed (const char *key_str) gui_key_pressed (const char *key_str)
{ {
int i, first_key, context, length, length_key, rc, signal_sent; int first_key, context, length, length_key, rc, signal_sent;
struct t_gui_key *ptr_key; struct t_gui_key *ptr_key;
char *pos, signal_name[128], **commands; char *pos, signal_name[128], **commands, **ptr_command;
signal_sent = 0; signal_sent = 0;
@@ -1390,10 +1390,10 @@ gui_key_pressed (const char *key_str)
commands = string_split_command (ptr_key->command, ';'); commands = string_split_command (ptr_key->command, ';');
if (commands) if (commands)
{ {
for (i = 0; commands[i]; i++) for (ptr_command = commands; *ptr_command; ptr_command++)
{ {
(void) input_data (gui_current_window->buffer, (void) input_data (gui_current_window->buffer,
commands[i], NULL); *ptr_command, NULL);
} }
string_free_split (commands); string_free_split (commands);
} }
+6 -5
View File
@@ -759,8 +759,9 @@ int
gui_line_match_tags (struct t_gui_line_data *line_data, gui_line_match_tags (struct t_gui_line_data *line_data,
int tags_count, char ***tags_array) int tags_count, char ***tags_array)
{ {
int i, j, k, match, tag_found, tag_negated; int i, j, match, tag_found, tag_negated;
const char *ptr_tag; const char *ptr_tag;
char **ptr;
if (!line_data) if (!line_data)
return 0; return 0;
@@ -768,9 +769,9 @@ gui_line_match_tags (struct t_gui_line_data *line_data,
for (i = 0; i < tags_count; i++) for (i = 0; i < tags_count; i++)
{ {
match = 1; match = 1;
for (j = 0; tags_array[i][j]; j++) for (ptr = tags_array[i]; *ptr; ptr++)
{ {
ptr_tag = tags_array[i][j]; ptr_tag = *ptr;
tag_found = 0; tag_found = 0;
tag_negated = 0; tag_negated = 0;
@@ -787,9 +788,9 @@ gui_line_match_tags (struct t_gui_line_data *line_data,
} }
else else
{ {
for (k = 0; k < line_data->tags_count; k++) for (j = 0; j < line_data->tags_count; j++)
{ {
if (string_match (line_data->tags_array[k], ptr_tag, 0)) if (string_match (line_data->tags_array[j], ptr_tag, 0))
{ {
tag_found = 1; tag_found = 1;
break; break;
+1 -1
View File
@@ -54,7 +54,7 @@ set(LINK_LIBS)
include_directories(${GNUTLS_INCLUDE_PATH}) include_directories(${GNUTLS_INCLUDE_PATH})
list(APPEND LINK_LIBS ${GNUTLS_LIBRARY}) list(APPEND LINK_LIBS ${GNUTLS_LIBRARY})
list(APPEND LINK_LIBS ${GCRYPT_LDFLAGS}) list(APPEND LINK_LIBS ${LIBGCRYPT_LDFLAGS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# link with resolv lib on macOS # link with resolv lib on macOS
+19 -19
View File
@@ -1208,14 +1208,14 @@ void
irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel, irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
const char *nick) const char *nick)
{ {
int i, unmask_delay, length_tags, nick_found, join, account; int unmask_delay, length_tags, nick_found, join, account;
int chghost, setname, nick_changed, smart_filtered, remove_smart_filter; int chghost, setname, nick_changed, smart_filtered, remove_smart_filter;
time_t *ptr_time, date_min; time_t *ptr_time, date_min;
struct t_hdata *hdata_line, *hdata_line_data; struct t_hdata *hdata_line, *hdata_line_data;
struct t_gui_line *own_lines; struct t_gui_line *own_lines;
struct t_gui_line *line; struct t_gui_line *line;
struct t_gui_line_data *line_data; struct t_gui_line_data *line_data;
const char **tags, *irc_nick1, *irc_nick2; const char **tags, *irc_nick1, *irc_nick2, **ptr_tag;
char *new_tags, *nick_to_search; char *new_tags, *nick_to_search;
struct t_hashtable *hashtable; struct t_hashtable *hashtable;
@@ -1292,30 +1292,30 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
irc_nick1 = NULL; irc_nick1 = NULL;
irc_nick2 = NULL; irc_nick2 = NULL;
smart_filtered = 0; smart_filtered = 0;
for (i = 0; tags[i]; i++) for (ptr_tag = tags; *ptr_tag; ptr_tag++)
{ {
if (strncmp (tags[i], "nick_", 5) == 0) if (strncmp (*ptr_tag, "nick_", 5) == 0)
{ {
if (strcmp (tags[i] + 5, nick_to_search) == 0) if (strcmp (*ptr_tag + 5, nick_to_search) == 0)
nick_found = 1; nick_found = 1;
} }
else if (strcmp (tags[i], "irc_join") == 0) else if (strcmp (*ptr_tag, "irc_join") == 0)
join = 1; join = 1;
else if (strcmp (tags[i], "irc_account") == 0) else if (strcmp (*ptr_tag, "irc_account") == 0)
account = 1; account = 1;
else if (strcmp (tags[i], "irc_chghost") == 0) else if (strcmp (*ptr_tag, "irc_chghost") == 0)
chghost = 1; chghost = 1;
else if (strcmp (tags[i], "irc_setname") == 0) else if (strcmp (*ptr_tag, "irc_setname") == 0)
setname = 1; setname = 1;
else if (strcmp (tags[i], "irc_nick") == 0) else if (strcmp (*ptr_tag, "irc_nick") == 0)
nick_changed = 1; nick_changed = 1;
else if (strncmp (tags[i], "irc_nick1_", 10) == 0) else if (strncmp (*ptr_tag, "irc_nick1_", 10) == 0)
irc_nick1 = tags[i] + 10; irc_nick1 = *ptr_tag + 10;
else if (strncmp (tags[i], "irc_nick2_", 10) == 0) else if (strncmp (*ptr_tag, "irc_nick2_", 10) == 0)
irc_nick2 = tags[i] + 10; irc_nick2 = *ptr_tag + 10;
else if (strcmp (tags[i], "irc_smart_filter") == 0) else if (strcmp (*ptr_tag, "irc_smart_filter") == 0)
smart_filtered = 1; smart_filtered = 1;
length_tags += strlen (tags[i]) + 1; length_tags += strlen (*ptr_tag) + 1;
} }
/* check if we must remove tag "irc_smart_filter" in line */ /* check if we must remove tag "irc_smart_filter" in line */
@@ -1347,13 +1347,13 @@ irc_channel_join_smart_filtered_unmask (struct t_irc_channel *channel,
{ {
/* build a string with all tags, except "irc_smart_filter" */ /* build a string with all tags, except "irc_smart_filter" */
new_tags[0] = '\0'; new_tags[0] = '\0';
for (i = 0; tags[i]; i++) for (ptr_tag = tags; *ptr_tag; ptr_tag++)
{ {
if (strcmp (tags[i], "irc_smart_filter") != 0) if (strcmp (*ptr_tag, "irc_smart_filter") != 0)
{ {
if (new_tags[0]) if (new_tags[0])
strcat (new_tags, ","); strcat (new_tags, ",");
strcat (new_tags, tags[i]); strcat (new_tags, *ptr_tag);
} }
} }
hashtable = weechat_hashtable_new (4, hashtable = weechat_hashtable_new (4,
+10 -10
View File
@@ -423,8 +423,8 @@ char *
irc_server_eval_fingerprint (struct t_irc_server *server) irc_server_eval_fingerprint (struct t_irc_server *server)
{ {
const char *ptr_fingerprint; const char *ptr_fingerprint;
char *fingerprint_eval, **fingerprints, *str_sizes; char *fingerprint_eval, **fingerprints, *str_sizes, **ptr;
int i, j, rc, algo, length; int i, rc, algo, length;
ptr_fingerprint = IRC_SERVER_OPTION_STRING(server, ptr_fingerprint = IRC_SERVER_OPTION_STRING(server,
IRC_SERVER_OPTION_SSL_FINGERPRINT); IRC_SERVER_OPTION_SSL_FINGERPRINT);
@@ -459,18 +459,18 @@ irc_server_eval_fingerprint (struct t_irc_server *server)
return fingerprint_eval; return fingerprint_eval;
rc = 0; rc = 0;
for (i = 0; fingerprints[i]; i++) for (ptr = fingerprints; *ptr; ptr++)
{ {
length = strlen (fingerprints[i]); length = strlen (*ptr);
algo = irc_server_fingerprint_search_algo_with_size (length * 4); algo = irc_server_fingerprint_search_algo_with_size (length * 4);
if (algo < 0) if (algo < 0)
{ {
rc = -1; rc = -1;
break; break;
} }
for (j = 0; j < length; j++) for (i = 0; i < length; i++)
{ {
if (!isxdigit ((unsigned char)fingerprints[i][j])) if (!isxdigit ((unsigned char)((*ptr)[i])))
{ {
rc = -2; rc = -2;
break; break;
@@ -4625,7 +4625,7 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
const char *good_fingerprints) const char *good_fingerprints)
{ {
unsigned char *fingerprint_server[IRC_FINGERPRINT_NUM_ALGOS]; unsigned char *fingerprint_server[IRC_FINGERPRINT_NUM_ALGOS];
char **fingerprints; char **fingerprints, **ptr_fingerprint;
int i, rc, algo; int i, rc, algo;
size_t size_bits, size_bytes; size_t size_bits, size_bytes;
@@ -4645,9 +4645,9 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
rc = 0; rc = 0;
for (i = 0; fingerprints[i]; i++) for (ptr_fingerprint = fingerprints; *ptr_fingerprint; ptr_fingerprint++)
{ {
size_bits = strlen (fingerprints[i]) * 4; size_bits = strlen (*ptr_fingerprint) * 4;
size_bytes = size_bits / 8; size_bytes = size_bits / 8;
algo = irc_server_fingerprint_search_algo_with_size (size_bits); algo = irc_server_fingerprint_search_algo_with_size (size_bits);
@@ -4689,7 +4689,7 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
if (fingerprint_server[algo]) if (fingerprint_server[algo])
{ {
/* check if the fingerprint matches */ /* check if the fingerprint matches */
if (irc_server_compare_fingerprints (fingerprints[i], if (irc_server_compare_fingerprints (*ptr_fingerprint,
fingerprint_server[algo], fingerprint_server[algo],
size_bytes) == 0) size_bytes) == 0)
{ {
+1 -1
View File
@@ -46,7 +46,7 @@ set(LINK_LIBS)
include_directories(${GNUTLS_INCLUDE_PATH}) include_directories(${GNUTLS_INCLUDE_PATH})
list(APPEND LINK_LIBS ${GNUTLS_LIBRARY}) list(APPEND LINK_LIBS ${GNUTLS_LIBRARY})
list(APPEND LINK_LIBS ${GCRYPT_LDFLAGS}) list(APPEND LINK_LIBS ${LIBGCRYPT_LDFLAGS})
list(APPEND LINK_LIBS ${ZLIB_LIBRARY}) list(APPEND LINK_LIBS ${ZLIB_LIBRARY})
@@ -229,8 +229,9 @@ relay_weechat_protocol_handshake_reply (struct t_relay_client *client,
RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake) RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
{ {
char **options, **auths, **compressions, *pos; char **options, **auths, **compressions, *pos, **ptr_option, **ptr_auth;
int i, j, index_hash_algo, hash_algo_found, auth_allowed, compression; char **ptr_comp;
int index_hash_algo, hash_algo_found, auth_allowed, compression;
int password_received, plain_text_password; int password_received, plain_text_password;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0); RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
@@ -252,14 +253,14 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
weechat_string_split_command (argv_eol[0], ',') : NULL; weechat_string_split_command (argv_eol[0], ',') : NULL;
if (options) if (options)
{ {
for (i = 0; options[i]; i++) for (ptr_option = options; *ptr_option; ptr_option++)
{ {
pos = strchr (options[i], '='); pos = strchr (*ptr_option, '=');
if (pos) if (pos)
{ {
pos[0] = '\0'; pos[0] = '\0';
pos++; pos++;
if (strcmp (options[i], "password_hash_algo") == 0) if (strcmp (*ptr_option, "password_hash_algo") == 0)
{ {
password_received = 1; password_received = 1;
auths = weechat_string_split ( auths = weechat_string_split (
@@ -273,10 +274,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
NULL); NULL);
if (auths) if (auths)
{ {
for (j = 0; auths[j]; j++) for (ptr_auth = auths; *ptr_auth; ptr_auth++)
{ {
index_hash_algo = relay_auth_password_hash_algo_search ( index_hash_algo = relay_auth_password_hash_algo_search (*ptr_auth);
auths[j]);
if ((index_hash_algo >= 0) && (index_hash_algo > hash_algo_found)) if ((index_hash_algo >= 0) && (index_hash_algo > hash_algo_found))
{ {
auth_allowed = weechat_string_match_list ( auth_allowed = weechat_string_match_list (
@@ -290,7 +290,7 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
weechat_string_free_split (auths); weechat_string_free_split (auths);
} }
} }
else if (strcmp (options[i], "compression") == 0) else if (strcmp (*ptr_option, "compression") == 0)
{ {
compressions = weechat_string_split ( compressions = weechat_string_split (
pos, pos,
@@ -303,9 +303,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
NULL); NULL);
if (compressions) if (compressions)
{ {
for (j = 0; compressions[j]; j++) for (ptr_comp = compressions; *ptr_comp; ptr_comp++)
{ {
compression = relay_weechat_compression_search (compressions[j]); compression = relay_weechat_compression_search (*ptr_comp);
if (compression >= 0) if (compression >= 0)
{ {
RELAY_WEECHAT_DATA(client, compression) = compression; RELAY_WEECHAT_DATA(client, compression) = compression;
@@ -365,8 +365,9 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(handshake)
RELAY_WEECHAT_PROTOCOL_CALLBACK(init) RELAY_WEECHAT_PROTOCOL_CALLBACK(init)
{ {
char **options, *pos, *relay_password, *totp_secret, *info_totp_args, *info_totp; char **options, *pos, *relay_password, *totp_secret;
int i, length, password_received, totp_received; char *info_totp_args, *info_totp, **ptr_option;
int length, password_received, totp_received;
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0); RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
@@ -384,26 +385,26 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(init)
weechat_string_split_command (argv_eol[0], ',') : NULL; weechat_string_split_command (argv_eol[0], ',') : NULL;
if (options) if (options)
{ {
for (i = 0; options[i]; i++) for (ptr_option = options; *ptr_option; ptr_option++)
{ {
pos = strchr (options[i], '='); pos = strchr (*ptr_option, '=');
if (pos) if (pos)
{ {
pos[0] = '\0'; pos[0] = '\0';
pos++; pos++;
if (strcmp (options[i], "password") == 0) if (strcmp (*ptr_option, "password") == 0)
{ {
password_received = 1; password_received = 1;
if (relay_auth_password (client, pos, relay_password)) if (relay_auth_password (client, pos, relay_password))
RELAY_WEECHAT_DATA(client, password_ok) = 1; RELAY_WEECHAT_DATA(client, password_ok) = 1;
} }
else if (strcmp (options[i], "password_hash") == 0) else if (strcmp (*ptr_option, "password_hash") == 0)
{ {
password_received = 1; password_received = 1;
if (relay_auth_password_hash (client, pos, relay_password)) if (relay_auth_password_hash (client, pos, relay_password))
RELAY_WEECHAT_DATA(client, password_ok) = 1; RELAY_WEECHAT_DATA(client, password_ok) = 1;
} }
else if (strcmp (options[i], "totp") == 0) else if (strcmp (*ptr_option, "totp") == 0)
{ {
totp_received = 1; totp_received = 1;
if (totp_secret) if (totp_secret)
+3 -3
View File
@@ -64,7 +64,7 @@ trigger_command_display_trigger_internal (const char *name,
int verbose) int verbose)
{ {
char str_conditions[64], str_regex[64], str_command[64], str_rc[64]; char str_conditions[64], str_regex[64], str_command[64], str_rc[64];
char str_post_action[64], spaces[256]; char str_post_action[64], spaces[256], **ptr_command;
int i, length; int i, length;
if (verbose >= 1) if (verbose >= 1)
@@ -135,7 +135,7 @@ trigger_command_display_trigger_internal (const char *name,
} }
if (commands) if (commands)
{ {
for (i = 0; commands[i]; i++) for (ptr_command = commands, i = 0; *ptr_command; ptr_command++, i++)
{ {
weechat_printf_date_tags ( weechat_printf_date_tags (
NULL, 0, "no_trigger", NULL, 0, "no_trigger",
@@ -145,7 +145,7 @@ trigger_command_display_trigger_internal (const char *name,
i + 1, i + 1,
weechat_color ("chat_delimiters"), weechat_color ("chat_delimiters"),
weechat_color ("reset"), weechat_color ("reset"),
commands[i], *ptr_command,
weechat_color ("chat_delimiters")); weechat_color ("chat_delimiters"));
} }
} }
+1 -1
View File
@@ -34,7 +34,7 @@ set_target_properties(xfer PROPERTIES PREFIX "")
set(LINK_LIBS) set(LINK_LIBS)
list(APPEND LINK_LIBS ${GCRYPT_LDFLAGS}) list(APPEND LINK_LIBS ${LIBGCRYPT_LDFLAGS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# link with resolv lib on macOS # link with resolv lib on macOS
+5
View File
@@ -244,4 +244,9 @@ TEST(CoreUtil, VersionNumber)
LONGS_EQUAL(0x01010100, util_version_number ("1.1.1")); LONGS_EQUAL(0x01010100, util_version_number ("1.1.1"));
LONGS_EQUAL(0x01010200, util_version_number ("1.1.2")); LONGS_EQUAL(0x01010200, util_version_number ("1.1.2"));
LONGS_EQUAL(0x01020304, util_version_number ("1.2.3.4")); LONGS_EQUAL(0x01020304, util_version_number ("1.2.3.4"));
LONGS_EQUAL(0x7EFFFFFF, util_version_number ("126.255.255.255"));
LONGS_EQUAL(0x7FFFFFFF, util_version_number ("127.255.255.255"));
LONGS_EQUAL(0x7FFFFFFF, util_version_number ("128.255.255.255"));
LONGS_EQUAL(0x7FFFFFFF, util_version_number ("255.255.255.255"));
LONGS_EQUAL(0x7FFFFFFF, util_version_number ("999999999.999999999.999999999.999999999"));;
} }
+7 -5
View File
@@ -110,11 +110,13 @@ test_patches ()
PATCHES_OK=0 PATCHES_OK=0
PATCHES_ERROR=0 PATCHES_ERROR=0
for file in "${ROOT_DIR}"/tools/debian/patches/*.patch; do for file in "${ROOT_DIR}"/tools/debian/patches/*.patch; do
echo "=== Testing patch ${file} ===" if [ -f "${file}" ]; then
if git apply --check "${file}"; then echo "=== Testing patch ${file} ==="
PATCHES_OK=$((PATCHES_OK+1)) if git apply --check "${file}"; then
else PATCHES_OK=$((PATCHES_OK+1))
PATCHES_ERROR=$((PATCHES_ERROR+1)) else
PATCHES_ERROR=$((PATCHES_ERROR+1))
fi
fi fi
done done
echo "Patches: ${PATCHES_OK} OK, ${PATCHES_ERROR} in error." echo "Patches: ${PATCHES_OK} OK, ${PATCHES_ERROR} in error."
@@ -1,26 +0,0 @@
diff --git a/debian-devel/control b/debian-devel/control
index 1abbda247..0db73f390 100644
--- a/debian-devel/control
+++ b/debian-devel/control
@@ -14,7 +14,7 @@ Build-Depends:
libaspell-dev,
liblua5.3-dev,
tcl8.6-dev,
- guile-3.0-dev,
+ guile-2.2-dev,
php-dev, libphp-embed, libargon2-dev, libsodium-dev,
libxml2-dev,
libcurl4-gnutls-dev,
diff --git a/debian-stable/control b/debian-stable/control
index 428f11ce9..dcf71da3e 100644
--- a/debian-stable/control
+++ b/debian-stable/control
@@ -14,7 +14,7 @@ Build-Depends:
libaspell-dev,
liblua5.3-dev,
tcl8.6-dev,
- guile-3.0-dev,
+ guile-2.2-dev,
php-dev, libphp-embed, libargon2-dev, libsodium-dev,
libxml2-dev,
libcurl4-gnutls-dev,
@@ -1 +0,0 @@
weechat_debian_buster.patch
@@ -1,62 +0,0 @@
diff --git a/debian-devel/compat b/debian-devel/compat
index 48082f72f..b4de39476 100644
--- a/debian-devel/compat
+++ b/debian-devel/compat
@@ -1 +1 @@
-12
+11
diff --git a/debian-devel/control b/debian-devel/control
index 1abbda247..41addd80b 100644
--- a/debian-devel/control
+++ b/debian-devel/control
@@ -5,7 +5,7 @@ Maintainer: Sébastien Helleu <flashcode@flashtux.org>
Build-Depends:
asciidoctor (>= 1.5.4),
ruby-pygments.rb,
- debhelper (>= 12),
+ debhelper (>= 11),
cmake, pkg-config,
libncursesw5-dev,
gem2deb,
@@ -14,8 +14,8 @@ Build-Depends:
libaspell-dev,
liblua5.3-dev,
tcl8.6-dev,
- guile-3.0-dev,
- php-dev, libphp-embed, libargon2-dev, libsodium-dev,
+ guile-2.2-dev,
+ php-dev, libphp-embed, libargon2-0-dev, libsodium-dev,
libxml2-dev,
libcurl4-gnutls-dev,
libgcrypt20-dev,
diff --git a/debian-stable/compat b/debian-stable/compat
index 48082f72f..b4de39476 100644
--- a/debian-stable/compat
+++ b/debian-stable/compat
@@ -1 +1 @@
-12
+11
diff --git a/debian-stable/control b/debian-stable/control
index 428f11ce9..e88f167b8 100644
--- a/debian-stable/control
+++ b/debian-stable/control
@@ -5,7 +5,7 @@ Maintainer: Emmanuel Bouthenot <kolter@debian.org>
Build-Depends:
asciidoctor (>= 1.5.4),
ruby-pygments.rb,
- debhelper (>= 12),
+ debhelper (>= 11),
cmake, pkg-config,
libncursesw5-dev,
gem2deb,
@@ -14,8 +14,8 @@ Build-Depends:
libaspell-dev,
liblua5.3-dev,
tcl8.6-dev,
- guile-3.0-dev,
- php-dev, libphp-embed, libargon2-dev, libsodium-dev,
+ guile-2.2-dev,
+ php-dev, libphp-embed, libargon2-0-dev, libsodium-dev,
libxml2-dev,
libcurl4-gnutls-dev,
libgcrypt20-dev,
+2 -2
View File
@@ -33,8 +33,8 @@
# #
WEECHAT_STABLE=3.8 WEECHAT_STABLE=3.8
WEECHAT_DEVEL=3.8 WEECHAT_DEVEL=3.8.1
WEECHAT_DEVEL_FULL=3.8 WEECHAT_DEVEL_FULL=3.8.1-dev
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo >&2 "Syntax: $0 stable|devel|devel-full|devel-major|devel-minor|devel-patch" echo >&2 "Syntax: $0 stable|devel|devel-full|devel-major|devel-minor|devel-patch"