http://git.alpinelinux.org/cgit/ncopa/nldev/tree/nldev-handler.c

 - child(): the parent is blocking as long as the child is running -
this is not safe if a user registers a bad-behaved helper. The
parent should be able to kill the child after a timeout.

 - line 76: especially since you're blocking while a child is alive,
it's very possible that on bursts, the listener will fill the pipe
with events that the handler will all read at once. You absolutely
need a mini-protocol to separate the events.

 - lines 70-71: let users start the listener (which will spawn the
handler) with the environment, and the PATH, that they want. It's
easy enough to clear the environment before starting the listener
if needed.

 - rather that changing the handler's environment (which is messy,
stores state in the parent when none is needed, and may cause
fragmentation), build a new envp for the child and use execve()
or execle().

 - line 43: that's a huge buffer, especially since you're not
looping around read() and the listener never sends more than
4k bytes at a time. Is there a reason why it's so big ? And is
there a reason why it's static instead of simply in the stack ?

 - line 107: why the checks ? This will break if the uevent protocol
changes (which may happen, despite Linus' best efforts). Just spawn
the child and let it complain and die if it doesn't get the variables
it expects.

--
 Laurent

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to