From 1bedb81fca3aaff7fe5a7b29b7227f6763262e4f Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sat, 29 Jun 2019 15:59:20 -0600 Subject: [PATCH] error out if string is too long --- cmd/watchdog/installer/install_windows.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/watchdog/installer/install_windows.go b/cmd/watchdog/installer/install_windows.go index 0ea74e7..aae1a12 100644 --- a/cmd/watchdog/installer/install_windows.go +++ b/cmd/watchdog/installer/install_windows.go @@ -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)