ipn: add a comment about skipping files with null bytes

Updates #954
This commit is contained in:
Brad Fitzpatrick 2020-11-24 11:07:49 -08:00
parent 72e082aaf5
commit cd6099113f
1 changed files with 5 additions and 0 deletions

View File

@ -278,6 +278,11 @@ func LoadPrefs(filename string) (*Prefs, error) {
return nil, fmt.Errorf("LoadPrefs open: %w", err) // err includes path
}
if bytes.Contains(data, jsonEscapedZero) {
// Tailscale 1.2.0 - 1.2.8 on Windows had a memory corruption bug
// in the backend process that ended up sending NULL bytes over JSON
// to the frontend which wrote them out to JSON files on disk.
// So if we see one, treat is as corrupt and the user will need
// to log in again. (better than crashing)
return nil, os.ErrNotExist
}
p, err := PrefsFromBytes(data, false)