[19215] in Kerberos_V5_Development
Re: C99 Features
daemon@ATHENA.MIT.EDU (Nico Williams)
Fri Jun 19 15:02:20 2015
Date: Fri, 19 Jun 2015 14:02:00 -0500
From: Nico Williams <nico@cryptonector.com>
To: Danilo Almeida <dalmeida@mit.edu>
Message-ID: <20150619190159.GG6117@localhost>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <33E2E06D4C33464A97D0F4884B25430658AB25C8@OC11EXPO25.exchange.mit.edu>
Cc: "'krbdev@mit.edu'" <krbdev@mit.edu>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: krbdev-bounces@mit.edu
On Thu, Jun 18, 2015 at 01:13:40AM +0000, Danilo Almeida wrote:
> <quote from="Nico">
> Both are fine when the sizes are naturally limited to small sizes, but
> this requires more review effort. Alternatively one could have a
> macro to guard against unsafe array sizes. I'd rather VLAs and
> alloca() were frowned upon (though not forbidden).
> </quote>
>
> I am not sure how such a macro would work.
A macro could work for alloca:
void *alloca_abort() { abort(); }
#define GUARDED_ALLOCA(requested, max) \
(requested <= max ? alloca(requested) : alloca_abort())
Obviously there may be other failure handling options.
Nico
--
_______________________________________________
krbdev mailing list krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev