[PATCH] Make sure base 64 encoded string is null-terminated when using GnuTLS to encode
12 Jan
2017
12 Jan
'17
5:55 p.m.
--- librtmp/rtmp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index a2863b0..511822e 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -2451,8 +2451,11 @@ b64enc(const unsigned char *input, int length, char *output, int maxsize) return 0; } #elif defined(USE_GNUTLS) - if (BASE64_ENCODE_RAW_LENGTH(length) <= maxsize) - base64_encode_raw((uint8_t*) output, length, input); + if (BASE64_ENCODE_RAW_LENGTH(length) < maxsize) + { + base64_encode_raw((uint8_t*) output, length, input); + output[BASE64_ENCODE_RAW_LENGTH(length)] = '\0'; + } else { RTMP_Log(RTMP_LOGDEBUG, "%s, error", __FUNCTION__); -- 2.8.1.windows.1
3525
Age (days ago)
3525
Last active (days ago)
0 comments
1 participants
participants (1)
-
Isaac Schemm