system/nxcamera: fix sscanf overflow

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
Peter Bee 2023-02-16 14:29:21 +08:00 committed by Xiang Xiao
parent 1207977447
commit ce84d5d7cd

View File

@ -152,12 +152,12 @@ static int nxcamera_cmd_stream(FAR struct nxcamera_s *pcam, FAR char *parg)
uint32_t framerate = 0;
uint32_t format = 0;
int ret;
char cc[4] =
char cc[5] =
{
0
};
sscanf(parg, "%hd %hd %d %s", &width, &height, &framerate, cc);
sscanf(parg, "%hd %hd %d %4s", &width, &height, &framerate, cc);
format = v4l2_fourcc(cc[0], cc[1], cc[2], cc[3]);
/* Try to stream raw data with settings specified */