Skip to content

Commit

Permalink
Fix bug in fuzzer ID length
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-stripe committed Aug 6, 2018
1 parent 029be04 commit 02638cd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ func init() {

func usableHostName(orig string) (valid string) {
valid = invalidFuzzerNames.ReplaceAllString(orig, "_")
// fuzzer name is ${hostname}-xxxx, so this string can be max 29 chars
if len(valid) > 29 {
valid = valid[0:29]
// Max AFL fuzzer ID is 32:
// https://github.com/mirrorer/afl/blob/2fb5a3482ec27b593c57258baae7089ebdc89043/afl-fuzz.c#L7456
//
// Our fuzzer ID is ${hostname}-xxxx, so the hostname portion can
// be max 32 - 5 = 27 chars.
maxHostnameLen := 27
if len(valid) > maxHostnameLen {
valid = valid[0:maxHostnameLen]
}
return
}
Expand Down

0 comments on commit 02638cd

Please sign in to comment.