}
static bool
-assign_file_to_slot (unsigned long i, const char *file, unsigned int dir)
+assign_file_to_slot (unsigned int i, const char *file, unsigned int dir)
{
if (i >= files_allocated)
{
files_allocated = i + 32;
/* Catch wraparound. */
- if (files_allocated <= old)
+ if (files_allocated < old
+ || files_allocated < i
+ || files_allocated > UINT_MAX / sizeof (struct file_entry))
{
- as_bad (_("file number %lu is too big"), (unsigned long) i);
+ as_bad (_("file number %u is too big"), i);
return false;
}