@@ -293,7 +293,8 @@ dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg)
if (!ioc)
return 0;
- if (umoven(tcp, arg, sizeof(*ioc) - sizeof(ioc->data), ioc) < 0) {
+ if ((umoven(tcp, arg, sizeof(*ioc) - sizeof(ioc->data), ioc) < 0) ||
+ (ioc->data_size < offsetof(struct dm_ioctl, data_size))) {
free(ioc);
return 0;
}
@@ -335,6 +336,11 @@ dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg)
goto skip;
}
+ if (ioc->data_size < (sizeof(*ioc) - sizeof(ioc->data))) {
+ tprints(", /* Incorrect data_size */ ...");
+ goto skip;
+ }
+
dm_decode_device(code, ioc);
dm_decode_values(tcp, code, ioc);
dm_decode_flags(ioc);