Skip to content

Added guard to split not to get out of bounds exception when testing#288

Merged
appleboy merged 3 commits intogin-contrib:masterfrom
rogersm:master
May 22, 2025
Merged

Added guard to split not to get out of bounds exception when testing#288
appleboy merged 3 commits intogin-contrib:masterfrom
rogersm:master

Conversation

@rogersm
Copy link
Copy Markdown
Contributor

@rogersm rogersm commented Apr 16, 2025

In the current test code we're accessing the splitted slice without checking if split returned a slice long enough.

    s := strings.Split(c, ";")
    if s[1] != " Path=/foo/bar/bat" {
	t.Error("Error writing path with options:", s[1])
    }

This patch checks the len of s is enough to access s[1]

@appleboy appleboy merged commit 12aa9f4 into gin-contrib:master May 22, 2025
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

Successfully merging this pull request may close these issues.

2 participants