Subject: libssh crash on Mac

libssh crash on Mac

From: Leo <>
Date: Thu, 7 Mar 2019 03:32:37 -0500

Hi all,

I recently ran into the following strange issue:

I have two Xcode projects - for two apps - that, among other things, are
using libssh to connect to SFTP. When it comes to SFTP connection, the
projects are almost identical (one started as a copy of another). The
apps worked for years with no issues.

However, recently one of the apps started crashing on attempt to connect
to SFTP. Another app connects with no problems.

After running tons of tests, I just can't find any differences in the
two projects that could explain the crash in one of the apps.

The crash happens when invoking a contentsOfDirectoryAtPath method in a
third party class that's using libssh.

The Xcode debugger indicates exactly where the crash happens - I
included the details below.

I wonder if anyone can give me any pointers regarding what should I look
for in my project that could cause a crash in that specific place?

File: kex.c
Function: diffie_hellman_sha1

The exact line/error:

             libssh2_sha1_ctx fingerprint_ctx;


session->server_hostkey,  <-------------Thread 1: EXC_BAD_ACCESS
(code=1, address=0x0)


Some basic project details:

Xcode 10.1
macOS 10.14 (but the crash happens on earlier versions too)

I realize that I may need to provide additional info - please let me
know what info can be helpful then.

Thanks for any help,
Received on 2019-03-07