diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-10-10 14:23:18 +0300 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-10-11 10:56:58 +0300 |
commit | 17f66065837415e0b1b4d619f12a2219af987c80 (patch) | |
tree | fd4270c54ee0a9f0c733d76f38d3d7829de4b40a /lib/libmtd_legacy.c | |
parent | 56840a198a70604ece50d9d727cebcc28930ab4c (diff) |
mkfs.ubifs: rewrite path checking
We use the 'in_path()' function to check whether the output image is
withing the mkfs.ubifs root directory or not. However, this function
is not correct and it fails for the following situation, as
Marcus Prebble <marcus.prebble@axis.com> reports:
1. We have our root file-system mounted at / and want to build an image
out of it.
2. We have tmpfs mounted at /tmp
3. We mount the root file-system under /tmp/newroot
4. We run mkfs.ubifs with -r /tmp/newroot -o /tmp/image
And this fails. It fails because 'in_path()' misses this use-case.
This patch re-implements the check completely. Now we use 'realpath()'
to find canonical paths and just check that the output file is not
under the root mkfs.ubifs directory.
Reported-by: Marcus Prebble <marcus.prebble@axis.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tested-by: Marcus Prebble <marcus.prebble@axis.com>
Diffstat (limited to 'lib/libmtd_legacy.c')
0 files changed, 0 insertions, 0 deletions