getdata: potential overflow due unit change

The commit c28488cbe8 introduced
potential memory overflow due unintentional unit change.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-07-08 15:27:15 +02:00
parent c28488cbe8
commit 3c1d033a79

View file

@ -148,6 +148,7 @@ int parse_leases(void)
leasesmallocsize = leasesmallocsize =
sizeof(unsigned long int) * num_leases * 2; sizeof(unsigned long int) * num_leases * 2;
leases = safe_realloc(leases, leasesmallocsize); leases = safe_realloc(leases, leasesmallocsize);
leasesmallocsize /= sizeof(unsigned long int);
} }
sw_active_lease = 1; sw_active_lease = 1;
} else if (strstr(line, " binding state free")) { } else if (strstr(line, " binding state free")) {
@ -158,6 +159,7 @@ int parse_leases(void)
sizeof(unsigned long int) * num_touches * 2; sizeof(unsigned long int) * num_touches * 2;
touches = touches =
safe_realloc(touches, touchesmallocsize); safe_realloc(touches, touchesmallocsize);
touchesmallocsize /= sizeof(unsigned long int);
} }
} else if (strstr(line, " binding state backup")) { } else if (strstr(line, " binding state backup")) {
if (num_backups == 0) { if (num_backups == 0) {
@ -172,6 +174,7 @@ int parse_leases(void)
sizeof(unsigned long int) * num_backups * 2; sizeof(unsigned long int) * num_backups * 2;
backups = backups =
safe_realloc(backups, backupsmallocsize); safe_realloc(backups, backupsmallocsize);
backupsmallocsize /= sizeof(unsigned long int);
} }
} }