You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/02/16 11:00:34 UTC

[nuttx-apps] branch master updated: system/nxcamera: fix sscanf overflow

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new ce84d5d7c system/nxcamera: fix sscanf overflow
ce84d5d7c is described below

commit ce84d5d7cdd4223f86af1a34ad8e2c5733c91ed7
Author: Peter Bee <bi...@xiaomi.com>
AuthorDate: Thu Feb 16 14:29:21 2023 +0800

    system/nxcamera: fix sscanf overflow
    
    Signed-off-by: Peter Bee <bi...@xiaomi.com>
---
 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 */