Displaying 2 results from an estimated 2 matches for "3c88d2e".
2012 Oct 24
2
[BUG][PATCH][BTRFS-PROGS] Bug overflow fix
...ncpy is that, if there is no null byte
among the first n bytes of src, the string placed in dest
will not be null - terminated.
Signed-off-by: Rock Lee <zimilo@code-trick.com>
---
utils.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/utils.c b/utils.c
index 3c88d2e..7200aef 100644
--- a/utils.c
+++ b/utils.c
@@ -969,7 +969,7 @@ int btrfs_scan_one_dir(char *dirname, int run_ioctl)
pending = malloc(sizeof(*pending));
if (!pending)
return -ENOMEM;
- strcpy(pending->name, dirname);
+ snprintf(pending->name, sizeof(pending->name), "%s", d...
2012 Oct 24
2
[BUG][BTRFS-PROGS] Fix Bug to corrupt the img file
...rock 2.0M Oct 24 09:53 btrfs-small.img
Here you can see the original img file''s size goes larger to 2Mbytes.
Signed-off-by: Rock Lee <zimilo@code-trick.com>
---
utils.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/utils.c b/utils.c
index 205e667..3c88d2e 100644
--- a/utils.c
+++ b/utils.c
@@ -441,7 +441,7 @@ static int zero_blocks(int fd, off_t start, size_t len)
return ret;
}
-static int zero_dev_start(int fd)
+static int zero_dev_start(int fd, u64 dev_size)
{
off_t start = 0;
size_t len = 2 * 1024 * 1024;
@@ -451,6 +451...