Skip to content
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

plugins services oracledb parseInfo version index out of range #32

Open
Adminisme opened this issue Aug 2, 2024 · 0 comments
Open

plugins services oracledb parseInfo version index out of range #32

Adminisme opened this issue Aug 2, 2024 · 0 comments

Comments

@Adminisme
Copy link

Adminisme commented Aug 2, 2024

I finded a bug in github.com/praetorian-inc/[email protected]/pkg/plugins/services/oracledb/oracle.go:225, oracle version parseInfo runtime error: index out of range [1] with length 0.
fix it,it‘s work:

func parseInfo(response []byte) map[string]any {
	refuseData := response[12:]
	code := regexp.MustCompile(`[0-9]+`).FindAllStringSubmatch(string(refuseData), 2)
	VSNNum := code[0][0]
	ErrCode := code[1][0]
	VsNum, _ := strconv.Atoi(VSNNum)
	version := big.NewInt(int64(VsNum)).Bytes()
	versionStr := ""
	if len(version) == 4 {
		split := "00"
		if version[1] != 0 {
			split = fmt.Sprintf("%02s", strconv.FormatInt(int64(version[1]), 16))
		}
		versionStr = fmt.Sprintf("%d.%s.%s.%d.%d", version[0], string(split[0]), string(split[1]), version[2], version[3])
	}
	return map[string]any{"Oracle TNS Listener Version": versionStr, "VSNNUM": VSNNum, "ERROR_CODE": ErrCode}
}
@Adminisme Adminisme changed the title plugins services oracledb version index out of range plugins services oracledb parseInfo version index out of range Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant