Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] erofs-utils: fsck: never follow exist symlinks when overwriting
@ 2022-01-26  3:37 Gao Xiang
  2022-01-26  3:37 ` [PATCH 2/2] erofs-utils: fsck: don't set attributes when fscking only Gao Xiang
  0 siblings, 1 reply; 2+ messages in thread
From: Gao Xiang @ 2022-01-26  3:37 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang

Otherwise, we could face potential security issues.

Fixes: 412c8f908132 ("erofs-utils: fsck: add --extract=X support to extract to path X")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fsck/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index 14534b9..f2af609 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -496,8 +496,8 @@ static inline int erofs_extract_file(struct erofs_inode *inode)
 
 again:
 	fd = open(fsckcfg.extract_path,
-		  O_WRONLY | O_CREAT | (fsckcfg.overwrite ? O_TRUNC : O_EXCL),
-		  0700);
+		  O_WRONLY | O_CREAT | O_NOFOLLOW |
+			(fsckcfg.overwrite ? O_TRUNC : O_EXCL), 0700);
 	if (fd < 0) {
 		if (fsckcfg.overwrite && tryagain) {
 			if (errno == EISDIR) {
-- 
2.24.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-26  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-26  3:37 [PATCH 1/2] erofs-utils: fsck: never follow exist symlinks when overwriting Gao Xiang
2022-01-26  3:37 ` [PATCH 2/2] erofs-utils: fsck: don't set attributes when fscking only Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox