Search Linux Wireless

RE: [PATCH] ipw2200: prevent alloc of unspecified size on stack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday, December 18, 2007 10:35 PM, Al Viro  wrote:

> On Tue, Dec 18, 2007 at 10:01:02PM -0800, Reinette Chatre wrote:
>> +	/* not using min() because of its strict type checking */
>> +	log_size = sizeof(*log) * log_len < PAGE_SIZE ?
> 
> 		   PAGE_SIZE / sizeof(*log) > len ?
> 
> to be provably safe against wraparounds, if you really want to limit
> that to PAGE_SIZE...

To cover this I reset log_len after allocating the memory:

+	}
+	log_len = log_size / sizeof(*log);
 	ipw_capture_event_log(priv, log_len, log);


If we use the original length then we are ok and log_len is just what it
was before. If we use PAGE_SIZE then log_len is reset to fit in the
amount of memory we allocated (PAGE_SIZE).

Is this what you meant?

Reinette
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux