summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/irc/irc-sasl.c55
-rw-r--r--src/plugins/relay/relay-websocket.c6
-rw-r--r--src/plugins/weechat-plugin.h4
3 files changed, 49 insertions, 16 deletions
diff --git a/src/plugins/irc/irc-sasl.c b/src/plugins/irc/irc-sasl.c
index 689e7ecb8..63d9bf6e5 100644
--- a/src/plugins/irc/irc-sasl.c
+++ b/src/plugins/irc/irc-sasl.c
@@ -72,7 +72,14 @@ irc_sasl_mechanism_plain (const char *sasl_username, const char *sasl_password)
answer_base64 = malloc (length * 4);
if (answer_base64)
- weechat_string_encode_base64 (string, length - 1, answer_base64);
+ {
+ if (weechat_string_encode_base64 (string, length - 1,
+ answer_base64) < 0)
+ {
+ free (answer_base64);
+ answer_base64 = NULL;
+ }
+ }
free (string);
}
@@ -219,15 +226,17 @@ irc_sasl_mechanism_ecdsa_nist256p_challenge (struct t_irc_server *server,
pubkey_base64 = malloc ((x.size + 1 + 1) * 4);
if (pubkey_base64)
{
- weechat_string_encode_base64 (pubkey, x.size + 1,
- pubkey_base64);
- weechat_printf (
- server->buffer,
- _("%s%s: signing the challenge with ECC public key: "
- "%s"),
- weechat_prefix ("network"),
- IRC_PLUGIN_NAME,
- pubkey_base64);
+ if (weechat_string_encode_base64 (pubkey, x.size + 1,
+ pubkey_base64) >= 0)
+ {
+ weechat_printf (
+ server->buffer,
+ _("%s%s: signing the challenge with ECC public "
+ "key: %s"),
+ weechat_prefix ("network"),
+ IRC_PLUGIN_NAME,
+ pubkey_base64);
+ }
free (pubkey_base64);
}
free (pubkey);
@@ -289,7 +298,13 @@ irc_sasl_mechanism_ecdsa_nist256p_challenge (struct t_irc_server *server,
{
answer_base64 = malloc ((length + 1) * 4);
if (answer_base64)
- weechat_string_encode_base64 (string, length, answer_base64);
+ {
+ if (weechat_string_encode_base64 (string, length, answer_base64) < 0)
+ {
+ free (answer_base64);
+ answer_base64 = NULL;
+ }
+ }
free (string);
string = NULL;
}
@@ -504,7 +519,14 @@ irc_sasl_mechanism_dh_blowfish (const char *data_base64,
/* encode answer to base64 */
answer_base64 = malloc ((length_answer + 1) * 4);
if (answer_base64)
- weechat_string_encode_base64 (answer, length_answer, answer_base64);
+ {
+ if (weechat_string_encode_base64 (answer, length_answer,
+ answer_base64) < 0)
+ {
+ free (answer_base64);
+ answer_base64 = NULL;
+ }
+ }
bfend:
if (secret_bin)
@@ -626,7 +648,14 @@ irc_sasl_mechanism_dh_aes (const char *data_base64,
/* encode answer to base64 */
answer_base64 = malloc ((length_answer + 1) * 4);
if (answer_base64)
- weechat_string_encode_base64 (answer, length_answer, answer_base64);
+ {
+ if (weechat_string_encode_base64 (answer, length_answer,
+ answer_base64) < 0)
+ {
+ free (answer_base64);
+ answer_base64 = NULL;
+ }
+ }
aesend:
if (secret_bin)
diff --git a/src/plugins/relay/relay-websocket.c b/src/plugins/relay/relay-websocket.c
index bbac751dc..60c4f4526 100644
--- a/src/plugins/relay/relay-websocket.c
+++ b/src/plugins/relay/relay-websocket.c
@@ -214,7 +214,11 @@ relay_websocket_build_handshake (struct t_relay_client *client)
length = gcry_md_get_algo_dlen (GCRY_MD_SHA1);
gcry_md_write (hd, key, strlen (key));
result = gcry_md_read (hd, GCRY_MD_SHA1);
- weechat_string_encode_base64 ((char *)result, length, sec_websocket_accept);
+ if (weechat_string_encode_base64 ((char *)result, length,
+ sec_websocket_accept) < 0)
+ {
+ sec_websocket_accept[0] = '\0';
+ }
gcry_md_close (hd);
free (key);
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index e9416d2ce..94aa54598 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -67,7 +67,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
-#define WEECHAT_PLUGIN_API_VERSION "20180812-01"
+#define WEECHAT_PLUGIN_API_VERSION "20181102-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -323,7 +323,7 @@ struct t_weechat_plugin
void (*string_free_split_command) (char **split_command);
char *(*string_format_size) (unsigned long long size);
char *(*string_remove_color) (const char *string, const char *replacement);
- void (*string_encode_base64) (const char *from, int length, char *to);
+ int (*string_encode_base64) (const char *from, int length, char *to);
int (*string_decode_base64) (const char *from, char *to);
char *(*string_hex_dump) (const char *data, int data_size,
int bytes_per_line, const char *prefix,