On Mit, 2015-07-01 at 14:35 -0400, Rich Felker wrote:
> On Wed, Jul 01, 2015 at 04:46:18PM +0100, Ron Yorston wrote:
> > Now that the only thing protected by setjmp/longjmp is the saved string,
> > we can allocate it on the stack to get rid of the jump.
> > 
> > Based on commit bd35d8e from 
> > git://git.kernel.org/pub/scm/utils/dash/dash.git
> > by Herbert Xu.
> 
> In general alloca is unsafe. It's not obvious to me what the code here
> is doing, so I can't tell for sure if it's safe or not, but I think
> this needs a strong justification of safety before being acceptable.

Since (GNU-)C99 is used: What about variable length arrays instead of
alloca?
BTW this wouldn't be the first use of alloca():
----  snip  ----
{13}find -name '*.[ch]' -type f | xargs fgrep -wc alloca | grep -v ':0$'
./networking/inetd.c:4
./networking/httpd.c:2
./libpwdgrp/uidgid_get.c:1
./findutils/find.c:3
./shell/ash.c:1
./shell/math.c:3
./libbb/pw_encrypt_sha.c:2
./libbb/xconnect.c:1
./libbb/copyfd.c:1
./libbb/getopt32.c:2
./scripts/basic/docproc.c:3
./scripts/basic/fixdep.c:3
./scripts/kconfig/lex.zconf.c:1
./scripts/kconfig/zconf.tab.c:2
./modutils/modutils-24.c:7
----  snip  ----
(did that just after a `git pull`)

Kind regards,
        Bernd
-- 
"I dislike type abstraction if it has no real reason. And saving
on typing is not a good reason - if your typing speed is the main
issue when you're coding, you're doing something seriously wrong."
    - Linus Torvalds

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to