This is the mail archive of the
mailing list for the glibc project.
Re: [patch] Fix BZ #17916 fopen unbounded stack usage for ccs= modes
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Paul Pluzhnikov <ppluzhnikov at gmail dot com>
- Cc: GLIBC Devel <libc-alpha at sourceware dot org>
- Date: Sun, 22 Feb 2015 21:59:55 +0100
- Subject: Re: [patch] Fix BZ #17916 fopen unbounded stack usage for ccs= modes
- Authentication-results: sourceware.org; auth=none
- References: <CALoOobPBCpZwMyF5F_4XzNJKKi64xMGtWgBXO_iDU_HpZ6+V9g at mail dot gmail dot com>
* Paul Pluzhnikov:
> Attached patch fixes BZ #17916 fopen unbounded stack usage for ccs= modes
> Tested on Linux/x86_64, no failures.
This should have a test case.
There is a missing NULL check on the malloc result. I don't think the
alloca optimization makes sense because this functionality is used so
rarely, and the function allocates on the heap anyway. Just use
malloc unconditionally; it will result in smaller code.