error out if string is too long

This commit is contained in:
AJ ONeal 2019-06-29 15:59:20 -06:00
parent b317446e7e
commit 1bedb81fca
1 changed files with 3 additions and 0 deletions

View File

@ -74,6 +74,9 @@ func install(c *Config) error {
// "C:\Users\aj\.local\opt\appname\appname.js /c -p 8080"
// "C:\Program Files (x64)\nodejs\node.exe /c C:\Users\aj\.local\opt\appname\appname.js -p 8080"
regSZ := bin + setArgs + strings.Join(c.Argv, " ")
if len(regSZ) > 260 {
return fmt.Errorf("data value is too long for registry entry")
}
fmt.Println("Set Registry Key:")
fmt.Println(autorunKey, c.Title, regSZ)
k.SetStringValue(c.Title, regSZ)