1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

tt_isam_record.C: fix CERT VU#387387 part 2

This commit is contained in:
Jon Trulson 2012-05-26 18:29:26 -06:00
parent e820f21540
commit 95e6fd42cc

View file

@ -159,5 +159,18 @@ void _Tt_isam_record::setBytes (int start,
int length,
const _Tt_string &value)
{
(void)memcpy((char *)buffer+start, (char *)value, length);
// JET - CERT vulnerability: VU#387387 - value is user supplied.
// Geez.
int bavail = (maxLength - start);
int bcp = 0;
if (bavail <= 0)
return;
if (bavail > length)
bcp = length;
else
bcp = bavail;
(void)memcpy((char *)buffer+start, (char *)value, bcp);
}