diff --git a/forms/rulerforms.go b/forms/rulerforms.go index c4a7711..8200a2d 100644 --- a/forms/rulerforms.go +++ b/forms/rulerforms.go @@ -62,10 +62,13 @@ func CreateFormAttachmentTemplate(folderid, messageid []byte, pstr string) error break } } + if index == -1 { + return fmt.Errorf("Couldn't find MAGIC string in template. Ensure you have a valid template.") + } //create our payload payload := utils.UniString(pstr) //convert to Unicode string payload = payload[:len(payload)-2] //get rid of null byte - remainder := 768 - len(pstr) //calculate the length of our padding. + remainder := 4096 - len(pstr) //calculate the length of our padding. rpr := utils.UniString(strings.Repeat(" ", remainder)) //generate padding payload = append(payload, rpr[:len(rpr)-2]...) //append padding (with null byte removed) to payload data := append([]byte{}, datafull[:index]...) //create new array with our template up to the index. doing it this way to force new array creation diff --git a/ruler.go b/ruler.go index 8ab1e5e..5cf2fc1 100644 --- a/ruler.go +++ b/ruler.go @@ -490,8 +490,8 @@ func createForm(c *cli.Context) error { command = c.String("command") } - if len(command) > 767 { - return fmt.Errorf("Command is too large. Maximum command size is 768 characters.") + if len(command) > 4096 { + return fmt.Errorf("Command is too large. Maximum command size is 4096 characters.") } suffix := c.String("suffix") diff --git a/templates/formtemplate.bin b/templates/formtemplate.bin index 548aee8..7c49aea 100644 Binary files a/templates/formtemplate.bin and b/templates/formtemplate.bin differ