aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-13 01:44:38 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-13 01:44:38 -0400
commit053ce0184c586b27a054c51e5b24132778156d14 (patch)
tree0d117b170a34d81421e90d6ac792020ae5778ab6 /pkg
parent624ffeb91846b8e6435258ca7483a013cbb36b57 (diff)
downloadAtlas-053ce0184c586b27a054c51e5b24132778156d14.tar.gz
Atlas-053ce0184c586b27a054c51e5b24132778156d14.zip
pkg/{pdata,pdef/pdefgen}: Fix string length check
Diffstat (limited to 'pkg')
-rw-r--r--pkg/pdata/persistent_player_data_version_231.go2
-rw-r--r--pkg/pdef/pdefgen/pdefgen.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/pkg/pdata/persistent_player_data_version_231.go b/pkg/pdata/persistent_player_data_version_231.go
index 6e5d835..cd1898a 100644
--- a/pkg/pdata/persistent_player_data_version_231.go
+++ b/pkg/pdata/persistent_player_data_version_231.go
@@ -64,7 +64,7 @@ func must(err error) {
}
func putString(b []byte, x string) error {
s := []byte(x)
- if len(s) > len(s) {
+ if len(s) > len(b) {
return fmt.Errorf("string length %d too long for field length %d", len(s), len(b))
}
for i, c := range s {
diff --git a/pkg/pdef/pdefgen/pdefgen.go b/pkg/pdef/pdefgen/pdefgen.go
index 80256fd..49aa19c 100644
--- a/pkg/pdef/pdefgen/pdefgen.go
+++ b/pkg/pdef/pdefgen/pdefgen.go
@@ -129,7 +129,7 @@ func main() {
pln(&buf, `func putString(b []byte, x string) error {`)
pln(&buf, `s := []byte(x)`)
- pln(&buf, `if len(s) > len(s) {`)
+ pln(&buf, `if len(s) > len(b) {`)
pln(&buf, `return fmt.Errorf(%#v, len(s), len(b))`, `string length %d too long for field length %d`)
pln(&buf, `}`)
pln(&buf, `for i, c := range s {`)