1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +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 ) { if ( *cur == (char)0x1b ) {
/* Only 0x1b ????? */ /* Only 0x1b ????? */
char tmp[3]; const int tmpsz = 4;
sprintf(tmp, "=%02X", (int)(unsigned char)*cur); char tmp[tmpsz];
snprintf(tmp, tmpsz, "=%02X", (int)(unsigned char)*cur);
memcpy(&line_buf[off], tmp, 3); memcpy(&line_buf[off], tmp, 3);
off += 3; off += 3;
continue; continue;