From ce84d5d7cdd4223f86af1a34ad8e2c5733c91ed7 Mon Sep 17 00:00:00 2001 From: Peter Bee Date: Thu, 16 Feb 2023 14:29:21 +0800 Subject: [PATCH] system/nxcamera: fix sscanf overflow Signed-off-by: Peter Bee --- system/nxcamera/nxcamera_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/nxcamera/nxcamera_main.c b/system/nxcamera/nxcamera_main.c index 71fcfdd1b..17c235d1c 100644 --- a/system/nxcamera/nxcamera_main.c +++ b/system/nxcamera/nxcamera_main.c @@ -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 */