mirror of
https://github.com/opnsense/src.git
synced 2026-05-04 17:05:14 -04:00
cxgb(4): Validate offset/len in the GET_EEPROM ioctl.
Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
This commit is contained in:
parent
09b0b8c058
commit
76aca1d671
1 changed files with 7 additions and 1 deletions
|
|
@ -2958,8 +2958,14 @@ cxgb_extension_ioctl(struct cdev *dev, unsigned long cmd, caddr_t data,
|
|||
case CHELSIO_GET_EEPROM: {
|
||||
int i;
|
||||
struct ch_eeprom *e = (struct ch_eeprom *)data;
|
||||
uint8_t *buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT);
|
||||
uint8_t *buf;
|
||||
|
||||
if (e->offset & 3 || e->offset >= EEPROMSIZE ||
|
||||
e->len > EEPROMSIZE || e->offset + e->len > EEPROMSIZE) {
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
buf = malloc(EEPROMSIZE, M_DEVBUF, M_NOWAIT);
|
||||
if (buf == NULL) {
|
||||
return (ENOMEM);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue