1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-12 19:22:41 +00:00

dtcm/RFCMIME: fix a guaranteed buffer overflow

This commit is contained in:
Jon Trulson 2021-12-19 12:25:50 -07:00
parent dddca18f9b
commit 4029c5b813

View file

@ -1300,8 +1300,9 @@ writeQPrint(char *buf, const char * bp, const unsigned long bp_len,
*/
if ( *cur == (char)0x1b ) {
/* Only 0x1b ????? */
char tmp[3];
sprintf(tmp, "=%02X", (int)(unsigned char)*cur);
const int tmpsz = 4;
char tmp[tmpsz];
snprintf(tmp, tmpsz, "=%02X", (int)(unsigned char)*cur);
memcpy(&line_buf[off], tmp, 3);
off += 3;
continue;