mailing list of musl libc
 help / color / mirror / code / Atom feed
* thoughts on reallocarray, explicit_bzero?
@ 2014-05-19 15:31 Isaac Dunham
  2014-05-19 15:43 ` Rich Felker
                   ` (2 more replies)
  0 siblings, 3 replies; 30+ messages in thread
From: Isaac Dunham @ 2014-05-19 15:31 UTC (permalink / raw)
  To: musl

Having read up on the LibreSSL fork of OpenSSL and also recently
backported a nuber of libXfont CVE fixes for integer overflows,
I've seen the risk posed by malloc(n*sizeof(x)) and realloc(ptr,
n*sizeof(x)).
calloc(n, sizeof(x)) can be used in place of malloc(n * sizeof(x)), 
but there's no standard function that does overflow checking for 
realloc(). OpenBSD has provided the extension reallocarray(), which 
provides for bounds checking like calloc() does.

Additionally, there are times when a compiler will optimize away calls
to bzero() on areas that are not used before free(); this can result in
passwords getting left in memory. OpenBSD uses a wrapper function called
explicit_bzero() to keep this from happening, thugh it seems to be possible
to use some ugliness with volatile to stop it.

Should musl provide reallocarray()? 
And what's the best way to ensure that memory gets zeroed out? 

Thanks,
Isaac Dunham


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2015-01-29 10:54 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-19 15:31 thoughts on reallocarray, explicit_bzero? Isaac Dunham
2014-05-19 15:43 ` Rich Felker
2014-05-19 16:19   ` Daniel Cegiełka
2014-05-20  6:19     ` Rich Felker
2014-05-20 15:50       ` Daniel Cegiełka
2014-05-19 15:44 ` Daniel Cegiełka
2014-05-19 16:16   ` Rich Felker
2014-05-19 16:30     ` Daniel Cegiełka
2014-05-19 16:32     ` Szabolcs Nagy
2015-01-28 22:01     ` Daniel Cegiełka
2015-01-28 22:34       ` Daniel Cegiełka
2015-01-28 22:38         ` Nathan McSween
2015-01-28 22:54           ` Daniel Cegiełka
2015-01-28 23:02             ` Josiah Worcester
2015-01-29  2:19         ` Rich Felker
2015-01-29  4:03           ` Brent Cook
2015-01-29  4:15             ` Rich Felker
2015-01-29  9:30               ` Daniel Cegiełka
2015-01-29 10:04                 ` Szabolcs Nagy
2015-01-29 10:31                   ` Daniel Cegiełka
2015-01-29 10:54                   ` Daniel Cegiełka
2014-05-19 16:25 ` Szabolcs Nagy
2014-05-19 16:45   ` Daniel Cegiełka
2014-05-19 16:58     ` Rich Felker
2014-05-19 16:55   ` Rich Felker
2014-05-19 18:12     ` Szabolcs Nagy
2014-05-19 22:08   ` Andy Lutomirski
2014-05-20  0:41     ` Szabolcs Nagy
2014-06-11  9:59   ` Thorsten Glaser
2014-06-11 12:59     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).