From 54c26c6296135a3c3da4422ab7e70843af3032e0 Mon Sep 17 00:00:00 2001 From: zhoupengcheng11 <2773414454@qq.com> Date: Wed, 8 Mar 2023 19:16:50 +0800 Subject: [PATCH] Initializing variable struct stat stbuf memory Enable the msan compilation option and compile the tar1.34 in clang.(https://clang.llvm.org/docs/MemorySanitizer.html) msan detects uninitialized variables in tar1.34,the patch fix the memory error detected by msan. --- src/system.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/system.c b/src/system.c index 2988ed08..76db1f38 100644 --- a/src/system.c +++ b/src/system.c @@ -283,6 +283,7 @@ static int is_regular_file (const char *name) { struct stat stbuf; + memset(&stbuf,0,sizeof(struct stat)); if (stat (name, &stbuf) == 0) return S_ISREG (stbuf.st_mode); -- 2.27.0