Hi Roel,
On Sat, 2009-08-29 at 13:53 +0200, Roel Kluin wrote:
> Test whether index exceeds fw->size before reading the element
>
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> I assume it's incorrect to read from fw->data[fw->size], but is
> that true?
That's correct, thanks. I applied your patch to my for-next branch.
Cheers,
Samuel.
> diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
> index 0c0831c..0b97bbd 100644
> --- a/drivers/net/irda/irda-usb.c
> +++ b/drivers/net/irda/irda-usb.c
> @@ -1122,11 +1122,12 @@ static int stir421x_patch_device(struct irda_usb_cb *self)
> * The actual image starts after the "STMP" keyword
> * so forward to the firmware header tag
> */
> - for (i = 0; (fw->data[i] != STIR421X_PATCH_END_OF_HDR_TAG)
> - && (i < fw->size); i++) ;
> + for (i = 0; i < fw->size && fw->data[i] !=
> + STIR421X_PATCH_END_OF_HDR_TAG; i++)
> + ;
> /* here we check for the out of buffer case */
> - if ((STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i])
> - && (i < STIR421X_PATCH_CODE_OFFSET)) {
> + if (i < STIR421X_PATCH_CODE_OFFSET && i < fw->size &&
> + STIR421X_PATCH_END_OF_HDR_TAG == fw->data[i]) {
> if (!memcmp(fw->data + i + 1, STIR421X_PATCH_STMP_TAG,
> sizeof(STIR421X_PATCH_STMP_TAG) - 1)) {
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> irda-users mailing list
> irda-users@xxxxxxxxxxxxxxxxxxxxx
> http://lists.sourceforge.net/lists/listinfo/irda-users
--
To unsubscribe from this list: send the line "unsubscribe irda-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Home]
[Linux SCSI]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]