Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1158506

Re: [PATCH] staging: fbtft: fix out of bound access

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] staging: fbtft: fix out of bound access
Date Thu, 04 Jun 2015 14:20:03 +0200
Message-ID <pxChR-xc-23@gated-at.bofh.it> (permalink)
References <pxBON-8al-5@gated-at.bofh.it>
X-Original-To Sudip Mukherjee <sudipm.mukherjee@gmail.com>
X-Session-Marker 6A6F6540706572636865732E636F6D
X-Spam-Summary 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:4321:5007:6119:6261:7903:7904:8603:10004:10400:10848:11026:11658:11914:12043:12296:12438:12517:12519:12740:13069:13095:13311:13357:13972:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0
X-He-Tag bath73_8969146c09823
X-Filterd-Recvd-Size 1722
Content-Type text/plain; charset="ISO-8859-1"
X-Mailer Evolution 3.12.11-0ubuntu3
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 26
Organization linux.* mail to news gateway
X-Original-Cc Thomas Petazzoni <thomas.petazzoni@free-electrons.com>, Noralf Trønnes <noralf@tronnes.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
X-Original-Date Thu, 04 Jun 2015 05:12:23 -0700
X-Original-Message-ID <1433419943.4861.167.camel@perches.com>
X-Original-References <1433418121-9434-1-git-send-email-sudipm.mukherjee@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1158506

Show key headers only | View raw


On Thu, 2015-06-04 at 17:12 +0530, Sudip Mukherjee wrote:
> size of str is 16, but in snprintf the size was mentioned as 128.
[]
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
[]
> @@ -1096,7 +1096,7 @@ static int fbtft_init_display_dt(struct fbtft_par *par)
>  			/* make debug message */
>  			msg[0] = '\0';
>  			for (j = 0; j < i; j++) {
> -				snprintf(str, 128, " %02X", buf[j]);
> +				snprintf(str, 16, " %02X", buf[j]);

using sizeof(str) is probably more robust

msg isn't big enough to hold the maximum possible output.

If this is really useful, and I rather doubt it is,
it'd probably be better to use a loop to output
multiple lines, one for each register.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] staging: fbtft: fix out of bound access Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-06-04 13:50 +0200
  Re: [PATCH] staging: fbtft: fix out of bound access Joe Perches <joe@perches.com> - 2015-06-04 14:20 +0200

csiph-web