lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 13 Jun 2010 16:52:53 -0400
From:	Valdis.Kletnieks@...edu
To:	Chase Douglas <chase.douglas@...onical.com>
Cc:	Steven Rostedt <srostedt@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] trace-cmd: prevent print_graph_duration buffer overflow

On Sun, 13 Jun 2010 13:11:48 EDT, Chase Douglas said:
> Passing n > sizeof(string) to snprintf can cause a glibc buffer overflow
> condition. We know the exact size of nsecs_str, so use it instead of
> math that may overflow.

>  	/* Print nsecs (we don't want to exceed 7 numbers) */
>  	if ((s->len - len) < 7) {
> -		snprintf(nsecs_str, 8 - (s->len - len), "%03lu", nsecs_rem);
> +		snprintf(nsecs_str, sizeof(nsecs_str), "%03lu", nsecs_rem);

We only get into this code after we've checked that the length is under 7
characters.  How much overflow can happen as long as the sizeof(nsecs_str) is a
sane size (like at least 8 chars)?  Probably a better bet would be doing the
right thing and 'BUILD_BUG_ON(sizeof(nsecs_str) < 8);'?


Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ