You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "Donny9 (via GitHub)" <gi...@apache.org> on 2023/10/25 13:09:33 UTC

[PR] fs/rename: fix use after free issue about rename [nuttx]

Donny9 opened a new pull request, #11039:
URL: https://github.com/apache/nuttx/pull/11039

   ## Summary
   fs/rename: fix use after free issue about rename
   ## Impact
   fix use after free issue
   ## Testing
   local test
   


-- 
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-unsubscribe@nuttx.apache.org

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


Re: [PR] fs/rename: fix use after free issue about rename [nuttx]

Posted by "Donny9 (via GitHub)" <gi...@apache.org>.
Donny9 commented on code in PR #11039:
URL: https://github.com/apache/nuttx/pull/11039#discussion_r1371763388


##########
fs/vfs/fs_rename.c:
##########
@@ -371,8 +363,19 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode,
                 }
               else
                 {
+                  /* Save subdir to free memory may be allocated in
+                   * previous loop.
+                   */
+
+                  FAR void *tmp = subdir;
+
                   ret = asprintf(&subdir, "%s/%s", newrelpath,
                                  subdirname);
+                  if (tmp != NULL)
+                    {
+                      kmm_free(tmp);

Review Comment:
   Done, thanks~



-- 
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-unsubscribe@nuttx.apache.org

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


Re: [PR] fs/rename: fix use after free issue about rename [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #11039:
URL: https://github.com/apache/nuttx/pull/11039


-- 
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-unsubscribe@nuttx.apache.org

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


Re: [PR] fs/rename: fix use after free issue about rename [nuttx]

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko commented on code in PR #11039:
URL: https://github.com/apache/nuttx/pull/11039#discussion_r1371748529


##########
fs/vfs/fs_rename.c:
##########
@@ -371,8 +363,19 @@ static int mountptrename(FAR const char *oldpath, FAR struct inode *oldinode,
                 }
               else
                 {
+                  /* Save subdir to free memory may be allocated in
+                   * previous loop.
+                   */
+
+                  FAR void *tmp = subdir;
+
                   ret = asprintf(&subdir, "%s/%s", newrelpath,
                                  subdirname);
+                  if (tmp != NULL)
+                    {
+                      kmm_free(tmp);

Review Comment:
   ```suggestion
                         lib_free(tmp);
   ```



-- 
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-unsubscribe@nuttx.apache.org

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