From 3c1d033a79ebae20618a4285353c9ae1b5c27a12 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 8 Jul 2011 15:27:15 +0200 Subject: [PATCH] getdata: potential overflow due unit change The commit c28488cbe8978b5b826944cdda5d626efe8ea102 introduced potential memory overflow due unintentional unit change. Signed-off-by: Sami Kerola --- src/getdata.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/getdata.c b/src/getdata.c index 4e878e2..097e1ad 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -148,6 +148,7 @@ int parse_leases(void) leasesmallocsize = sizeof(unsigned long int) * num_leases * 2; leases = safe_realloc(leases, leasesmallocsize); + leasesmallocsize /= sizeof(unsigned long int); } sw_active_lease = 1; } else if (strstr(line, " binding state free")) { @@ -158,6 +159,7 @@ int parse_leases(void) sizeof(unsigned long int) * num_touches * 2; touches = safe_realloc(touches, touchesmallocsize); + touchesmallocsize /= sizeof(unsigned long int); } } else if (strstr(line, " binding state backup")) { if (num_backups == 0) { @@ -172,6 +174,7 @@ int parse_leases(void) sizeof(unsigned long int) * num_backups * 2; backups = safe_realloc(backups, backupsmallocsize); + backupsmallocsize /= sizeof(unsigned long int); } }