summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-07-30 07:44:25 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-07-30 07:44:25 +0200
commitd2dc05b01ecd3722468b1c4dc38bb963f7321fb3 (patch)
tree43293c1fac79bf010636a04bd14f5e47237b36ac /src
parent3d6b9ff5a7bfda96b20bbf0433700f8d49932011 (diff)
downloadweechat-d2dc05b01ecd3722468b1c4dc38bb963f7321fb3.zip
core: check that from/to arguments are not NULL in base16/64 functions
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-string.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 4c893c9f5..de4443773 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -2338,6 +2338,9 @@ string_encode_base16 (const char *from, int length, char *to)
const char *hexa = "0123456789ABCDEF";
char *ptr_to;
+ if (!from || !to)
+ return;
+
ptr_to = to;
ptr_to[0] = '\0';
for (i = 0; i < length; i++)
@@ -2361,6 +2364,9 @@ string_decode_base16 (const char *from, char *to)
int length, to_length, i, pos;
unsigned char *ptr_to, value;
+ if (!from || !to)
+ return 0;
+
length = strlen (from) / 2;
ptr_to = (unsigned char *)to;
@@ -2425,6 +2431,9 @@ string_encode_base64 (const char *from, int length, char *to)
const char *ptr_from;
char *ptr_to;
+ if (!from || !to)
+ return;
+
ptr_from = from;
ptr_to = to;
@@ -2487,6 +2496,9 @@ string_decode_base64 (const char *from, char *to)
unsigned char base64_table[]="|$$$}rstuvwxyz{$$$$$$$>?"
"@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
+ if (!from || !to)
+ return 0;
+
ptr_from = from;
ptr_to = to;