[MPlayer-dev-eng] [Suggested PATCH] Increase maximum ftp file path length
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Nov 6 09:52:07 CET 2012
On 6 Nov 2012, at 01:28, Rodrigo Campos <rodrigo at sdfg.com.ar> wrote:
> On Mon, Nov 05, 2012 at 08:10:48PM +0100, Reimar Döffinger wrote:
>> On Mon, Nov 05, 2012 at 10:18:47AM +0200, Sergey wrote:
>>> On Mon, 5 Nov 2012 13:19:19 Xidorn Quan wrote:
>>
>>> Or should I mark all these variables "static" instead?
>>
>> No, that's really bad for maintainability.
>> I don't really see a reason to not use heap allocation of proper size,
>> those functions are hardly speed-critical.
>
> Or use variable-size arrays ? (just to forget about freeing it)
If you use variable size arrays all you have is now at least one problem more.
Because
1) They are not reliably supported by all compilers/platforms
2) You need to check the size you allocated before-hand, otherwise you just added an exploitable bug because your array actually ends up in another threads stack because it didn't fit into yours.
3) You can't actually do 2) properly because you know neither the size of your stack nor how much is used, so you have to limit it to a size around a few kB - and except in some special cases you could then just use a fixed-size array. In addition you have the risk that your compiler will optimize things (including inlining) so it writes to the array before you validated its size, then your code is still exploitable despite the check.
More information about the MPlayer-dev-eng
mailing list