Displaying 2 results from an estimated 2 matches for "dirname_len".
2012 Oct 24
2
[BUG][PATCH][BTRFS-PROGS] Bug overflow fix
...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", dirname);
again:
dirname_len = strlen(pending->name);
@@ -1010,7 +1010,8 @@ again:
ret = -ENOMEM;
goto fail;
}
- strcpy(next->name, fullpath);
+ snprintf(next->name, sizeof(next->name),
+ "%s", fullpath);
list_add_tail(&next->list, &pending_list);
}
if (!S_ISBLK(...
2004 Feb 06
4
memory reduction
...@@ -616,12 +616,12 @@ void receive_file_entry(struct file_stru
idev_len = 0;
sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0;
- file_struct_len = idev_len? sizeof file[0] : min_file_struct_len;
+ file_struct_len = min_file_struct_len;
alloc_len = file_struct_len + dirname_len + basename_len
- + linkname_len + sum_len + idev_len;
- if (!(bp = new_array(char, alloc_len)))
- out_of_memory("receive_file_entry");
+ + linkname_len + sum_len;
+ bp = pool_alloc(flist->file_pool, alloc_len, "receive_file_entry");
+
file = *fptr = (struct file_stru...