diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-07-30 07:44:25 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-07-30 07:44:25 +0200 |
commit | d2dc05b01ecd3722468b1c4dc38bb963f7321fb3 (patch) | |
tree | 43293c1fac79bf010636a04bd14f5e47237b36ac /src | |
parent | 3d6b9ff5a7bfda96b20bbf0433700f8d49932011 (diff) | |
download | weechat-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.c | 12 |
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; |