]> git.tuebingen.mpg.de Git - paraslash.git/commit
server: Fix segfault in com_sender().
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 24 Jul 2017 22:18:50 +0000 (00:18 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Fri, 28 Jul 2017 14:08:22 +0000 (16:08 +0200)
commit408371cd5c6c06cdbd51513ab49ff0bc376cda26
tree1dfb069385da3f8ee95b101fd114e3e0828e4dec
parentb59e841036a107b52a0221e48d7e05f86da92979
server: Fix segfault in com_sender().

Commit 1709cc8f (server: Convert non-afs commands to lopsub) from
one year ago dropped the terminating NULL pointer from the array
of sender commands, presumably because the array size is declared
as the NUM_SENDER_CMDS enum constant, and this constant can be used
to iterate over all sender subcommands.

However, the loop in check_sender_args() of command.c does not
terminate the loop after NUM_SENDER_CMDS elements but only when it
encounters a NULL pointer. Hence, without the terminating NULL, the
code reads beyond the end of the array. The resulting invalid memory
access causes the command handler process to segfault.

Fix this by changing the termination condition of the loop to check
the loop variable against NUM_SENDER_CMDS.
command.c