Skip to content

Initial handshake problem #351

@jasdefer

Description

@jasdefer

When connecting to my 10.0.31-MariaDB database, I get an exception during the initial handshake.
The problem occurs while reading the AuthPluginName. The FormatException Read past end of buffer looking for NUL. is thrown in the MySql.Data.ByteArrayReader.ReadNullTerminatedByteString() method. Even though the AuthPluginName should be mysql_native_password (see the provided byte buffer below).

m_offset=71, m_maxOffset=92 and the buffer (m_buffer) is

    [...]
    [70]: 0
    [71]: 109
    [72]: 121
    [73]: 115
    [74]: 113
    [75]: 108
    [76]: 95
    [77]: 110
    [78]: 97
    [79]: 116
    [80]: 105
    [81]: 118
    [82]: 101
    [83]: 95
    [84]: 112
    [85]: 97
    [86]: 115
    [87]: 115
    [88]: 119
    [89]: 111
    [90]: 114
    [91]: 100
    [92]: 0
    [93]: 0
    [94]: 0

I understand that index == m_maxOffset is true and therefore the exception is thrown.
When removing the following two lines from the ReadNullTerminatedByteString method, the connection can be established without any problems:

if (index == m_maxOffset)
    throw new FormatException("Read past end of buffer looking for NUL.");

I obviously don't want to remove those lines for production. Can someone help me out?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions