masayuki2009 commented on code in PR #7319:
URL: https://github.com/apache/incubator-nuttx/pull/7319#discussion_r997589673


##########
fs/procfs/fs_procfs.c:
##########
@@ -858,14 +843,16 @@ static int procfs_readdir(FAR struct inode *mountpt,
        * subdirectory are listed in order in the procfs_entry array.
        */
 
-      if (strncmp(g_procfs_entries[level1->base.index].pathpattern,
+      if (level1->base.index < g_procfs_entrycount &&
+          level1->firstindex < g_procfs_entrycount &&
+          strncmp(g_procfs_entries[level1->base.index].pathpattern,
                   g_procfs_entries[level1->firstindex].pathpattern,
                   level1->subdirlen) == 0)
         {
           /* This entry matches.  Report the subdir entry */
 
-          name = &g_procfs_entries[level1->base.index].pathpattern[
-                    level1->subdirlen + 1];
+          name = &g_procfs_entries[level1->base.index].
+                    pathpattern[level1->subdirlen + 1];

Review Comment:
   @xiaoxiang781216 
   I think this is a style change, so it would be better to merge the change 
into the first commit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to