From 82bc4c61b60e57630e8329510cab9976ff9fb1b5 Mon Sep 17 00:00:00 2001 From: dv Date: Wed, 10 Apr 2024 13:03:41 +0000 Subject: [PATCH] vmctl: fix incorrect scaling when converting disk images. ctl_convert still had old logic assuming disk sizes were in MiB and not bytes, causing an attempt to create a new disk using the '-i' argument to generate impossibly large output disk images (e.g. 1 MiB ends up 1 TiB). Reported by and diff from Jesper Wallin. --- usr.sbin/vmctl/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/usr.sbin/vmctl/main.c b/usr.sbin/vmctl/main.c index b4c10561d90..6621169dc5e 100644 --- a/usr.sbin/vmctl/main.c +++ b/usr.sbin/vmctl/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.75 2023/04/28 19:46:41 dv Exp $ */ +/* $OpenBSD: main.c,v 1.76 2024/04/10 13:03:41 dv Exp $ */ /* * Copyright (c) 2015 Reyk Floeter @@ -648,8 +648,6 @@ ctl_convert(const char *srcfile, const char *dstfile, int dsttype, size_t dstsiz if (dstsize == 0) dstsize = src.size; - else - dstsize *= 1048576; if (dstsize < (size_t)src.size) { errstr = "size cannot be smaller than input disk size"; goto done; -- 2.20.1