ensure setValue stays within buffer size

This commit is contained in:
Caleb An
2021-02-03 16:33:38 -08:00
parent 4096568e04
commit 78b9defa2b

View File

@@ -262,7 +262,8 @@ static void setValue( char * pSource, char dest[] )
{
// Destination is always one of our static buffers with size BUFSIZE
memset( dest, 0, BUFSIZE );
memcpy( dest, pSource, strlen(pSource) );
int length = (strlen(pSource) < BUFSIZE - 1) ? strlen(pSource) : (BUFSIZE - 1);
memcpy( dest, pSource, length );
}
static void setDataDir(char *pData)