[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: config: Do not access negative indexes of "seen" array


On Thursday, 16 August 2018 10:43:21 CEST Jakub Jelen wrote:
> Hello,
> running an application with latest libssh processing my configuration
> files, I noticed valgrind warning that libssh is accessing
> uninitialized value, something like this:
> 
> +==31722== Conditional jump or move depends on uninitialised value(s)
> +==31722==    at 0x730707D: ssh_config_parse_line (config.c:387)
> +==31722==    by 0x7307315: local_parse_file (config.c:312)
> +==31722==    by 0x7306900: local_parse_glob (config.c:346)
> +==31722==    by 0x7306900: ssh_config_parse_line (config.c:400)
> +==31722==    by 0x7307315: local_parse_file (config.c:312)
> +==31722==    by 0x7306900: local_parse_glob (config.c:346)
> +==31722==    by 0x7306900: ssh_config_parse_line (config.c:400)
> +==31722==    by 0x7307445: ssh_config_parse_file (config.c:666)
> +==31722==    by 0x7314167: ssh_options_parse_config (options.c:1285)
> +==31722==    by 0x1E7489: connect_to_ssh (ssh.c:679)
> +==31722==    by 0x1E7879: ssh_file_open (ssh.c:803)
> +==31722==    by 0x12F884: bdrv_open_driver (block.c:1191)
> +==31722==    by 0x1302B6: bdrv_open_common (block.c:1457)
> +==31722==    by 0x133183: bdrv_open_inherit (block.c:2752)
> 
> I was not able to reproduce it reliably with libssh testsuite (probably
> different complication flags or memory alignment), but it clearly
> pointed out to some of the unsupported configuration options that lead
> to accessing negative indexes in the "seen" array.
> 
> The attached patch should fix the problem. I extended also the
> testsuite with some tests for unknown or unsupported configuration
> options, making sure this is covered.

LGTM

Pushed to master ans stable-0.8


Thanks!

-- 
Andreas Schneider                 asn@xxxxxxxxxxxxxx
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D



References:
config: Do not access negative indexes of "seen" arrayJakub Jelen <jjelen@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org