]> git.tuebingen.mpg.de Git - paraslash.git/commit
recv: Don't segfault on invalid chunk values.
authorAndre Noll <maan@systemlinux.org>
Sun, 11 May 2014 19:47:03 +0000 (21:47 +0200)
committerAndre Noll <maan@systemlinux.org>
Sun, 11 May 2014 19:55:49 +0000 (21:55 +0200)
commit0160a4e41a7985ee17e1732ea5e18604001d5726
tree8295b392e8a8933f10964f5687744a3363d60a94
parentb0cbef19d0c704d570f42f8de80fe43664ada9f0
recv: Don't segfault on invalid chunk values.

If recv->open() fails, para_recv segfaults after

==10129== Conditional jump or move depends on uninitialised value(s)
==10129==    at 0x41BA18A: vfprintf (vfprintf.c:1634)
==10129==    by 0x41BE3D8: buffered_vfprintf (vfprintf.c:2311)
==10129==    by 0x41B975C: vfprintf (vfprintf.c:1289)
==10129==    by 0x804C6AF: stderr_log (in /home/maan/scm/paraslash/para_recv)
==10129==    by 0x804A193: main (recv.c:114)

This happens for example with the afh_receiver if the given start
chunk is bigger than the end chunk, e.g. when para_recv is executed as

./para_recv -r 'afh -b -80 -e -89 -f foo.opus'

The reason for the bug is we zero-out the stdout structure too late.
Fix this by initializing the stdout task structure upfront rather
than using memset().

This bug was introduced a year ago in commit b01605d7 (Avoid unwanted
log messages during startup) which moved down the call to memset().
recv.c