summaryrefslogtreecommitdiff
path: root/archiso
diff options
context:
space:
mode:
authorGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2013-01-08 20:20:03 -0300
committerGerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>2013-01-08 20:20:03 -0300
commit00d1126f708f077c333a0da48b5e7643eb4bb8ab (patch)
tree7fae494598c1f49c0c4065d1fa2db83892bb24ac /archiso
parent579ea0f3c1aa8d4f94faa9a9d5cca8a006c14772 (diff)
downloadarchiso32-00d1126f708f077c333a0da48b5e7643eb4bb8ab.tar.xz
[archiso] Avoid integer overflow when .fs is > 10.2G
Diffstat (limited to 'archiso')
-rw-r--r--archiso/initcpio/hooks/archiso7
1 files changed, 6 insertions, 1 deletions
diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso
index 491ed2f..66a6273 100644
--- a/archiso/initcpio/hooks/archiso
+++ b/archiso/initcpio/hooks/archiso
@@ -11,7 +11,12 @@ _mnt_fs() {
ro_dev=$(losetup --find --show --read-only "${img}")
echo ${ro_dev} >> /run/archiso/used_block_devices
ro_dev_size=$(blockdev --getsz ${ro_dev})
- rw_dev_size=$((ro_dev_size*cowfile_size/100))
+ if [[ "${cowfile_size}" == "100" ]]; then
+ rw_dev_size=${ro_dev_size}
+ else
+ # size calculation done in this way to avoid integer overflow when ro_dev_size is > 10.2G
+ rw_dev_size=$((ro_dev_size/100*cowfile_size))
+ fi
if [[ "${cow_persistent}" == "P" ]]; then
if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then