Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.BSM.4.64L.2403192046020.21682@herc.mirbsd.org>
Date: Tue, 19 Mar 2024 20:47:00 +0000 (UTC)
From: Thorsten Glaser <tg@...bsd.de>
To: musl@...ts.openwall.com
Subject: Re: Potential bug in __res_msend_rc() wrt to union initialization.

Jₑₙₛ Gustedt dixit:

>seems to be to always put the biggest union member first, or to even
>add an artificial first one `char [size-of-the-union] __dummy;`, such
>that this is always 0-byte initialized if there is any initialization

But then you can just memset the union and then initialise any
known pointer members to NULL/nullptr manually afterwards in the
union’s member you actually need.

(IIRC, POSIX actively specifies the possible pointer members in
these structs for that reason.)

bye,
//mirabilos
-- 
15:41⎜<Lo-lan-do:#fusionforge> Somebody write a testsuite for helloworld :-)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.