ssh-keygen opens NULL filename

Ben Lindstrom mouring at etoh.eviladmin.org
Thu Oct 17 04:37:50 EST 2002


On Wed, 16 Oct 2002, [iso-8859-2] Martin MOKREJ© wrote:

> Hi,
>   I did few checks and as I'm not C proghrammer at all, have just few
> points regarding ssh-keygen.c:
>
> 905             if (strstr(identity_file, dotsshdir) != NULL &&
>
> 	isn't the above line missing a closing bracket?
It does:

        if (strstr(identity_file, dotsshdir) != NULL &&
            stat(dotsshdir, &st) < 0) {

C does not require it to be on the same line.


> Could someone just have a look on gdb output at:
> http://www.natur.cuni.cz/~mmokrejs/openssh-3.5p1/ ? Thanks.
> In one of them, I also pointed out:
>
> 956                     snprintf(comment, sizeof comment, "%s@%s", pw->pw_name, hostname);
>
> -----------------------------------------------^ sizeof(comment) instead?
>

There is nothing wrong with snprintf(xx, sizeof xx, "..", ..).  If there
was then 60% of the world's code would fail.=)

> The identity_file variable contents somehow change over time, isn't that
> my problem? Same with hostname for example.
>

Looks like something is corrupting the stack according to your traces with
gdb.

what would be helpful is if you could check more offen between your first
'p identity_file' and the one that shows the ocrrupted version.  So it can
narrow down the code.

- Ben




More information about the openssh-unix-dev mailing list