[pve-devel] [PATCH cluster] add check for int overflow on vmids

Dominik Csapak d.csapak at proxmox.com
Mon Feb 15 12:02:10 CET 2016


this patch adds a check for overflow after converting the
<vmid>.conf path to an vmid (which are 32-bit integers)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 data/src/memdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/src/memdb.c b/data/src/memdb.c
index af20e05..57c2804 100644
--- a/data/src/memdb.c
+++ b/data/src/memdb.c
@@ -213,7 +213,7 @@ name_is_vm_config(
 	guint32 vmid =  strtoul(name, &end, 10);
 
 	if (!end || end[0] != '.' || end[1] != 'c'|| end[2] != 'o' || end[3] != 'n' ||
-	    end[4] != 'f' || end[5] != 0)
+	    end[4] != 'f' || end[5] != 0 || errno == ERANGE)
 		return FALSE;
 
 	if (vmid_ret)
-- 
2.1.4





More information about the pve-devel mailing list