mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
Off by one error in buffer length (issue 7379)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@41103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -363,7 +363,7 @@ int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int m
|
|||||||
byte |= *(src++);
|
byte |= *(src++);
|
||||||
bits += 8;
|
bits += 8;
|
||||||
cntin++;
|
cntin++;
|
||||||
if ((bits == 24) && (cnt + 4 < max)) {
|
if ((bits == 24) && (cnt + 4 <= max)) {
|
||||||
*dst++ = base64[(byte >> 18) & 0x3f];
|
*dst++ = base64[(byte >> 18) & 0x3f];
|
||||||
*dst++ = base64[(byte >> 12) & 0x3f];
|
*dst++ = base64[(byte >> 12) & 0x3f];
|
||||||
*dst++ = base64[(byte >> 6) & 0x3f];
|
*dst++ = base64[(byte >> 6) & 0x3f];
|
||||||
@@ -379,7 +379,7 @@ int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int m
|
|||||||
col = 0;
|
col = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bits && (cnt + 4 < max)) {
|
if (bits && (cnt + 4 <= max)) {
|
||||||
/* Add one last character for the remaining bits,
|
/* Add one last character for the remaining bits,
|
||||||
padding the rest with 0 */
|
padding the rest with 0 */
|
||||||
byte <<= 24 - bits;
|
byte <<= 24 - bits;
|
||||||
|
Reference in New Issue
Block a user