]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Fix clang warning and a resource leak
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 19 Jan 2015 21:31:49 +0000 (16:31 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 19 Jan 2015 21:31:49 +0000 (16:31 -0500)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/symlink.c
resize/resize2fs.c

index ba8ed8efe6770c2b53f8b4b315e231c426dd217b..7c485a5fd30406ac111fa3808e87563c9afcd775 100644 (file)
@@ -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) {
                        /*
index b3755f621feb4ba820226d319cd61fda25a06187..a2806b112d494cee918f75f84cffc730a3e39d20 100644 (file)
@@ -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,