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

core, plugins, tests: fix octal notation in strings

This commit is contained in:
Sébastien Helleu
2024-09-17 22:13:57 +02:00
parent 2b702f21d3
commit 02847246b2
13 changed files with 225 additions and 225 deletions
+2 -2
View File
@@ -446,7 +446,7 @@ irc_command_me_channel_message (struct t_irc_server *server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_LIST
| IRC_SERVER_SEND_MULTILINE,
NULL,
"PRIVMSG %s :\01ACTION%s%s\01",
"PRIVMSG %s :\001ACTION%s%s\001",
channel_name,
(message && message[0]) ? " " : "",
(message && message[0]) ? message : "");
@@ -6707,7 +6707,7 @@ IRC_COMMAND_CALLBACK(version)
&& irc_nick_search (ptr_server, ptr_channel, argv[1]))
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01VERSION\01", argv[1]);
"PRIVMSG %s :\001VERSION\001", argv[1]);
}
else
{
+14 -14
View File
@@ -170,7 +170,7 @@ irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
/*
* Extracts CTCP type and arguments from message, which format is:
* \01TYPE arguments...\01
* \001TYPE arguments...\001
*
* Strings *type and *arguments are set with type and arguments parsed,
* both are set to NULL in case of error.
@@ -188,10 +188,10 @@ irc_ctcp_parse_type_arguments (const char *message,
*type = NULL;
*arguments = NULL;
if (message[0] != '\01')
if (message[0] != '\001')
return;
pos_end = strrchr (message + 1, '\01');
pos_end = strrchr (message + 1, '\001');
if (!pos_end)
return;
@@ -263,7 +263,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_protocol_ctxt *ctxt,
while (ptr_args && ptr_args[0])
{
pos_end = strrchr (ptr_args + 1, '\01');
pos_end = strrchr (ptr_args + 1, '\001');
if (pos_end)
pos_end[0] = '\0';
@@ -396,7 +396,7 @@ irc_ctcp_display_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
{
char *ctcp_type, *ctcp_args, *ctcp_args_no_colors;
if (!ctxt || !arguments || (arguments[0] != '\01'))
if (!ctxt || !arguments || (arguments[0] != '\001'))
return;
irc_ctcp_parse_type_arguments (arguments, &ctcp_type, &ctcp_args);
@@ -434,10 +434,10 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
list_messages = NULL;
/*
* replace any "\01" by a space to prevent any firewall attack via
* replace any "\001" by a space to prevent any firewall attack via
* nf_conntrack_irc (CVE-2022-2663)
*/
dup_ctcp = weechat_string_replace (ctcp, "\01", " ");
dup_ctcp = weechat_string_replace (ctcp, "\001", " ");
if (!dup_ctcp)
goto end;
@@ -448,10 +448,10 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
if (arguments)
{
/*
* replace any "\01" by a space to prevent any firewall attack via
* replace any "\001" by a space to prevent any firewall attack via
* nf_conntrack_irc (CVE-2022-2663)
*/
dup_args = weechat_string_replace (arguments, "\01", " ");
dup_args = weechat_string_replace (arguments, "\001", " ");
if (!dup_args)
goto end;
}
@@ -461,7 +461,7 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_LIST
| IRC_SERVER_SEND_MULTILINE,
NULL,
"NOTICE %s :\01%s%s%s\01",
"NOTICE %s :\001%s%s%s\001",
ctxt->nick,
dup_ctcp_upper,
(dup_args) ? " " : "",
@@ -478,13 +478,13 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
ptr_message = (const char *)weechat_arraylist_get (list_messages, i);
if (!ptr_message)
break;
/* build arguments: '\01' + CTCP + ' ' + message + '\01' */
/* build arguments: '\001' + CTCP + ' ' + message + '\001' */
length = 1 + strlen (dup_ctcp_upper) + 1 + strlen (ptr_message) + 1 + 1;
message = malloc (length);
if (message)
{
snprintf (message, length,
"\01%s %s\01", dup_ctcp_upper, ptr_message);
"\001%s %s\001", dup_ctcp_upper, ptr_message);
irc_ctcp_display_reply_to_nick (ctxt, ctxt->nick, message);
free (message);
}
@@ -1419,7 +1419,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt,
while (ptr_args && ptr_args[0])
{
pos_end = strrchr (ptr_args + 1, '\01');
pos_end = strrchr (ptr_args + 1, '\001');
if (pos_end)
pos_end[0] = '\0';
@@ -1648,7 +1648,7 @@ irc_ctcp_send (struct t_irc_server *server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH
| IRC_SERVER_SEND_MULTILINE,
NULL,
"PRIVMSG %s :\01%s%s%s\01",
"PRIVMSG %s :\001%s%s%s\001",
target,
type,
(args) ? " " : "",
+2 -2
View File
@@ -315,8 +315,8 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
/* display only if capability "echo-message" is NOT enabled */
if (!weechat_hashtable_has_key (ptr_server->cap_list, "echo-message"))
{
action = ((strncmp (message, "\01ACTION ", 8) == 0)
|| (strncmp (message, "\01ACTION\01", 8) == 0));
action = ((strncmp (message, "\001ACTION ", 8) == 0)
|| (strncmp (message, "\001ACTION\001", 8) == 0));
list_size = weechat_arraylist_size (list_messages);
for (i = 0; i < list_size; i++)
{
+10 -10
View File
@@ -991,14 +991,14 @@ irc_message_split_add (struct t_irc_message_split_context *context,
* arguments: "Hello world!"
* suffix : ""
*
* message..: :nick!user@host.com PRIVMSG #channel :\01ACTION is eating\01
* message..: :nick!user@host.com PRIVMSG #channel :\001ACTION is eating\001
* arguments:
* host : ":nick!user@host.com"
* command : "PRIVMSG"
* target : "#channel"
* prefix : ":\01ACTION "
* prefix : ":\001ACTION "
* arguments: "is eating"
* suffix : "\01"
* suffix : "\001"
*
* Messages added to hashtable are:
* host + command + target + prefix + XXX + suffix
@@ -1330,7 +1330,7 @@ irc_message_end_batch (struct t_irc_message_split_context *context,
}
/*
* Splits a PRIVMSG or NOTICE message, taking care of keeping the '\01' char
* Splits a PRIVMSG or NOTICE message, taking care of keeping the '\001' char
* used in CTCP messages.
*
* If multiline == 1, the message is split on newline chars ('\n') and is sent
@@ -1457,13 +1457,13 @@ irc_message_split_privmsg_notice (struct t_irc_message_split_context *context,
{
for (i = 0; i < count_lines; i++)
{
/* for CTCP, prefix is ":\01xxxx " and suffix "\01" */
/* for CTCP, prefix is ":\001xxxx " and suffix "\001" */
prefix[0] = '\0';
suffix[0] = '\0';
ptr_args = list_lines[i];
length = strlen (list_lines[i]);
if ((list_lines[i][0] == '\01')
&& (list_lines[i][length - 1] == '\01'))
if ((list_lines[i][0] == '\001')
&& (list_lines[i][length - 1] == '\001'))
{
pos = strchr (list_lines[i], ' ');
if (pos)
@@ -1482,7 +1482,7 @@ irc_message_split_privmsg_notice (struct t_irc_message_split_context *context,
snprintf (prefix, sizeof (prefix), ":%s", list_lines[i]);
ptr_args = "";
}
suffix[0] = '\01';
suffix[0] = '\001';
suffix[1] = '\0';
}
if (!prefix[0])
@@ -1673,8 +1673,8 @@ irc_message_split (struct t_irc_server *server, const char *message)
&& message
&& strchr (message, '\n')
&& (index_args + 1 <= argc - 1)
&& (weechat_strncmp (argv[index_args + 1], "\01", 1) != 0)
&& (weechat_strncmp (argv[index_args + 1], ":\01", 2) != 0)
&& (weechat_strncmp (argv[index_args + 1], "\001", 1) != 0)
&& (weechat_strncmp (argv[index_args + 1], ":\001", 2) != 0)
&& weechat_hashtable_has_key (server->cap_list, "batch")
&& weechat_hashtable_has_key (server->cap_list, "draft/multiline"));
+10 -10
View File
@@ -2511,7 +2511,7 @@ IRC_PROTOCOL_CALLBACK(notice)
pos_target++;
}
if (ctxt->nick && (pos_args[0] == '\01'))
if (ctxt->nick && (pos_args[0] == '\001'))
{
cap_echo_message = weechat_hashtable_has_key (ctxt->server->cap_list,
"echo-message");
@@ -3017,8 +3017,8 @@ IRC_PROTOCOL_CALLBACK(pong)
*
* Parameter "arguments" is the message arguments, for example:
*
* \01VERSION\01
* \01TEST some arguments\01
* \001VERSION\001
* \001TEST some arguments\001
*/
void
@@ -3059,11 +3059,11 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_protocol_ctxt *ctxt,
* PRIVMSG #channel :message for channel here
* PRIVMSG @#channel :message for channel ops here
* PRIVMSG mynick :message for private here
* PRIVMSG #channel :\01ACTION is testing action\01
* PRIVMSG mynick :\01ACTION is testing action\01
* PRIVMSG #channel :\01VERSION\01
* PRIVMSG mynick :\01VERSION\01
* PRIVMSG mynick :\01DCC SEND file.txt 1488915698 50612 128\01
* PRIVMSG #channel :\001ACTION is testing action\001
* PRIVMSG mynick :\001ACTION is testing action\001
* PRIVMSG #channel :\001VERSION\001
* PRIVMSG mynick :\001VERSION\001
* PRIVMSG mynick :\001DCC SEND file.txt 1488915698 50612 128\001
*/
IRC_PROTOCOL_CALLBACK(privmsg)
@@ -3114,7 +3114,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
irc_channel_join_smart_filtered_unmask (ptr_channel, ctxt->nick);
/* CTCP to channel */
if (msg_args[0] == '\01')
if (msg_args[0] == '\001')
{
if (ctxt->nick_is_me)
{
@@ -3218,7 +3218,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
ptr_channel = irc_channel_search (ctxt->server, remote_nick);
/* CTCP to user */
if (msg_args[0] == '\01')
if (msg_args[0] == '\001')
{
msg_already_received = weechat_hashtable_has_key (
ctxt->server->echo_msg_recv, ctxt->irc_message);
+6 -6
View File
@@ -6365,7 +6365,7 @@ irc_server_xfer_send_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC SEND %s%s%s %s %d %s %s\01",
"PRIVMSG %s :\001DCC SEND %s%s%s %s %d %s %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6382,7 +6382,7 @@ irc_server_xfer_send_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC SEND %s%s%s %s %d %s\01",
"PRIVMSG %s :\001DCC SEND %s%s%s %s %d %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6396,7 +6396,7 @@ irc_server_xfer_send_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC CHAT chat %s %d\01",
"PRIVMSG %s :\001DCC CHAT chat %s %d\001",
weechat_infolist_string (infolist, "remote_nick"),
converted_addr,
weechat_infolist_integer (infolist, "port"));
@@ -6453,7 +6453,7 @@ irc_server_xfer_resume_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC RESUME %s%s%s %d %s %s\01",
"PRIVMSG %s :\001DCC RESUME %s%s%s %d %s %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6467,7 +6467,7 @@ irc_server_xfer_resume_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC RESUME %s%s%s %d %s\01",
"PRIVMSG %s :\001DCC RESUME %s%s%s %d %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6524,7 +6524,7 @@ irc_server_xfer_send_accept_resume_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC ACCEPT %s%s%s %d %s\01",
"PRIVMSG %s :\001DCC ACCEPT %s%s%s %d %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
+3 -3
View File
@@ -378,11 +378,11 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
mask2[0] = '\0';
/*
* we first replace directory separator (commonly '/') by \01 because
* we first replace directory separator (commonly '/') by \001 because
* buffer mask can contain this char, and will be replaced by replacement
* char ('_' by default)
*/
mask3 = weechat_string_replace (mask2, dir_separator, "\01");
mask3 = weechat_string_replace (mask2, dir_separator, "\001");
if (!mask3)
goto end;
@@ -407,7 +407,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
/* restore directory separator */
mask7 = weechat_string_replace (mask6,
"\01", dir_separator);
"\001", dir_separator);
if (!mask7)
goto end;
+10 -10
View File
@@ -1039,9 +1039,9 @@ relay_irc_send_channel_backlog (struct t_relay_client *client,
(ptr_host) ? "!" : "",
(ptr_host) ? ptr_host : "",
channel,
(irc_action) ? "\01ACTION " : "",
(irc_action) ? "\001ACTION " : "",
message,
(irc_action) ? "\01": "");
(irc_action) ? "\001": "");
}
break;
case RELAY_IRC_NUM_CMD:
@@ -1568,12 +1568,12 @@ relay_irc_recv_command_capab (struct t_relay_client *client,
*
* Examples:
*
* message | type | params
* --------------------------|-----------|-----------
* "\01ACTION is testing\01" | "ACTION" | "is testing"
* "\01VERSION\01" | "VERSION" | NULL
* "\01VERSION" | NULL | NULL
* "test" | NULL | NULL
* message | type | params
* ----------------------------|-----------|-------------
* "\001ACTION is testing\001" | "ACTION" | "is testing"
* "\001VERSION\001" | "VERSION" | NULL
* "\001VERSION" | NULL | NULL
* "test" | NULL | NULL
*/
void
@@ -1590,10 +1590,10 @@ relay_irc_parse_ctcp (const char *message, char **ctcp_type, char **ctcp_params)
if (!message)
return;
if (message[0] != '\01')
if (message[0] != '\001')
return;
pos_end = strrchr (message + 1, '\01');
pos_end = strrchr (message + 1, '\001');
if (!pos_end)
return;
+2 -2
View File
@@ -166,8 +166,8 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd)
length--;
}
if ((ptr_buf[0] == '\01')
&& (ptr_buf[length - 1] == '\01'))
if ((ptr_buf[0] == '\001')
&& (ptr_buf[length - 1] == '\001'))
{
ptr_buf[length - 1] = '\0';
ptr_buf++;
+1 -1
View File
@@ -60,7 +60,7 @@ xfer_command_me (const void *pointer, void *data,
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\r\n",
xfer_chat_sendf (ptr_xfer, "\001ACTION %s\001\r\n",
(argv_eol[1]) ? argv_eol[1] : "");
weechat_printf_date_tags (buffer,
0,