From c916e5248bab349f4375dcced9c8709fe4b1c8c2 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Mon, 19 Jan 2015 16:31:49 -0500 Subject: [PATCH] Fix clang warning and a resource leak Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- lib/ext2fs/symlink.c | 2 +- resize/resize2fs.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ext2fs/symlink.c b/lib/ext2fs/symlink.c index ba8ed8e..7c485a5 100644 --- a/lib/ext2fs/symlink.c +++ b/lib/ext2fs/symlink.c @@ -88,7 +88,7 @@ errcode_t ext2fs_symlink(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t ino, } else { /* Slow symlinks, target stored in the first block */ memset(block_buf, 0, fs->blocksize); - strcpy(block_buf, target); + strncpy(block_buf, target, fs->blocksize); if (fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) { /* diff --git a/resize/resize2fs.c b/resize/resize2fs.c index b3755f6..a2806b1 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -1852,8 +1852,10 @@ static errcode_t move_itables(ext2_resize_t rfs) ext2fs_inode_table_loc(fs, i)) to_move++; - if (to_move == 0) - return 0; + if (to_move == 0) { + retval = 0; + goto errout; + } if (rfs->progress) { retval = rfs->progress(rfs, E2_RSZ_MOVE_ITABLE_PASS, -- 1.8.3.1