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

fix(plugins/github): add length check in if statement #439

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.7.1

* [`d2a7b9a`](https://github.com/falcosecurity/plugins/pull/439/commits/d2a7b9a) fix(plugins/github): add length check in if statement


## v0.6.1


Expand Down
8 changes: 4 additions & 4 deletions plugins/github/pkg/github/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func getMatchField(jdata *fastjson.Value, matchField string, fType string) (bool

res += ","
}
if res[len(res)-1] == ',' {
if len(res) != 0 && res[len(res)-1] == ',' {
res = res[0 : len(res)-1]
}
}
Expand All @@ -97,7 +97,7 @@ func getMinerTypes(jdata *fastjson.Value) (bool, string) {
res += fmt.Sprintf("%s", t)
res += ","
}
if res[len(res)-1] == ',' {
if len(res) != 0 && res[len(res)-1] == ',' {
res = res[0 : len(res)-1]
}

Expand Down Expand Up @@ -146,7 +146,7 @@ func getfieldStr(jdata *fastjson.Value, field string) (bool, string) {
res += string(fname.GetStringBytes())
res += ","
}
if res[len(res)-1] == ',' {
if len(res) != 0 && res[len(res)-1] == ',' {
res = res[0 : len(res)-1]
}
}
Expand Down Expand Up @@ -188,7 +188,7 @@ func getfieldStr(jdata *fastjson.Value, field string) (bool, string) {
cinfo.GetUint64("line"))
res += ","
}
if res[len(res)-1] == ',' {
if len(res) != 0 && res[len(res)-1] == ',' {
res = res[0 : len(res)-1]
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/github/pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const (
PluginName = "github"
PluginDescription = "Reads github webhook events, by listening on a socket or by reading events from disk"
PluginContact = "github.com/falcosecurity/plugins"
PluginVersion = "0.7.0"
PluginVersion = "0.7.1"
PluginEventSource = "github"
ExtractEventSource = "github"
)
Expand Down
Loading