Commit 90c7881ecee1f08e0a49172cf61371cf2509ee4a

Authored by Dan Carpenter
Committed by David S. Miller
1 parent e70ab97799

irda: small read beyond end of array in debug code

charset comes from skb->data.  It's a number in the 0-255 range.
If we have debugging turned on then this could cause a read beyond
the end of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -495,8 +495,11 @@
495 495 /* case CS_ISO_8859_9: */
496 496 /* case CS_UNICODE: */
497 497 default:
498   - IRDA_DEBUG(0, "%s(), charset %s, not supported\n",
499   - __func__, ias_charset_types[charset]);
  498 + IRDA_DEBUG(0, "%s(), charset [%d] %s, not supported\n",
  499 + __func__, charset,
  500 + charset < ARRAY_SIZE(ias_charset_types) ?
  501 + ias_charset_types[charset] :
  502 + "(unknown)");
500 503  
501 504 /* Aborting, close connection! */
502 505 iriap_disconnect_request(self);