Skip to content

pluginName is empty lead to panic #810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fifsky opened this issue May 29, 2018 · 1 comment
Closed

pluginName is empty lead to panic #810

fifsky opened this issue May 29, 2018 · 1 comment

Comments

@fifsky
Copy link

fifsky commented May 29, 2018

pluginName = string(data[pos:])

Before I always use the library link AnalyticDB of Ali cloud, it is compatible with the MySQL protocol, but I recently updated the MySQL driver, after I get error message "unknown authentication plugin name ' '", after screening, found the following information, I did some adjustment to apply my application, hope these information can have some help

I printer data variable:

======>data: [10 53 46 49 46 51 49 45 109 121 115 113 108 45 97 100 115 0 118 37 242 9 89 116 86 49 69 90 77 112 97 104 48 81 54 84 79 54 51 86 67 112 0 0 0 0 0 0 0 97 104 48 81 54 84 79 54 51 86 67 112 0]
======>data: 
5.1.31-mysql-adsv%�     YtV1EZMpah0Q6TO63VCpah0Q6TO63VCp

I made the following changes to accommodate my code,Line[232:236]

before

		if end := bytes.IndexByte(data[pos:], 0x00); end != -1 {
			pluginName = string(data[pos : pos+end])
		} else {
			pluginName = data[pos:]
		}

after

		if end := bytes.IndexByte(data[pos:], 0x00); end != -1 {
			pluginName = string(data[pos : pos+end])
		} else {
			if p := string(data[pos:]); p != "" {
				pluginName = p
			}
		}
@julienschmidt
Copy link
Member

duplicate of #806

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants