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

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

commit f7a13f30f46322d54669a59157c6aea03bfab390
Author: xuxingliang <[email protected]>
AuthorDate: Thu Dec 25 13:31:06 2025 +0800

    syslog: ignore channel that not registered yet
    
    SYSLOGIOC_SETFILTER of /dev/log looks the channel up by name in all
    CONFIG_SYSLOG_MAX_CHANNELS entries of g_syslog_channel[], and the
    entries after the last registered channel are NULL, which it
    dereferenced.  Skip the empty entries.
    
    Signed-off-by: xuxingliang <[email protected]>
---
 drivers/syslog/syslog_chardev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/syslog/syslog_chardev.c b/drivers/syslog/syslog_chardev.c
index fb16bdea992..977a7917726 100644
--- a/drivers/syslog/syslog_chardev.c
+++ b/drivers/syslog/syslog_chardev.c
@@ -124,6 +124,11 @@ static int syslog_chardev_ioctl(FAR struct file *filep,
 
       for (i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++)
         {
+          if (g_syslog_channel[i] == NULL)
+            {
+              continue;
+            }
+
           if (strncmp(g_syslog_channel[i]->sc_name, info->sc_name,
                       sizeof(info->sc_name)) == 0)
             {

Reply via email to