Merge pull request #40 from Netflix/can/fix-cli-input-length

ensure setValue stays within buffer size
This commit is contained in:
Chintan Parikh
2021-02-04 09:55:06 -08:00
committed by GitHub

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)