[Samba] vfs fruit disk_free fails on tmsize overflow with macOS Time Machine
Art MG
smblock at artmg.org
Mon Feb 24 10:26:38 UTC 2020
Thanks torch – I tried those suggestions but nothing changed.
I did however manage to find an existing bug which matches my symptoms: https://bugzilla.samba.org/show_bug.cgi?id=13622
Fortunately it mentions a fix, but that was never implemented, so I created a new branch from v4-11-test on the gitlab shadow copy and tried the fix there. After compiling, my tests on Raspbian show that this does indeed fix the issue for me.
The diff for the patch is
--- source3/modules/vfs_fruit.c 2019-10-24 15:15:00.000000000 +0000
+++ source3/modules/vfs_fruit.c 2020-02-18 19:54:00.000000000 +0000
@@ -6971,18 +6971,7 @@
return true;
}
- if (bandsize > SIZE_MAX/nbands) {
- DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
- bandsize, nbands);
- return false;
- }
- tm_size = bandsize * nbands;
-
- if (state->total_size + tm_size < state->total_size) {
- DBG_ERR("tmsize overflow: bandsize [%zu] nbands [%zu]\n",
- bandsize, nbands);
- return false;
- }
+ tm_size = (off_t)bandsize * (off_t)nbands;
state->total_size += tm_size;
and I have the branch ready at https://gitlab.com/artmg/samba/-/blob/artmg-tmsize-overflow-fix/
Should I just raise a PR from this, or do I need to go through some additional process?
I welcome advice on contributing
Thanks
More information about the samba
mailing list