Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: make allMsg with 0 length to avoid display \x00 (#4692)

h3n4l0f935e2c5f60
diff --git a/backend/plugin/db/pg/dump.go b/backend/plugin/db/pg/dump.go
index fb6c23ba9e..0d1677ec22 100644
--- a/backend/plugin/db/pg/dump.go
+++ b/backend/plugin/db/pg/dump.go
@@ -146,13 +146,14 @@ func (driver *Driver) dumpOneDatabaseWithPgDump(ctx context.Context, database st
}
}
- allMsg := make([]byte, 1024)
+ // We init allMsg with 1024 bytes cap to avoid \x00 in the error message.
+ allMsg := make([]byte, 0, 1024)
for {
errorMsg := make([]byte, 1024)
readSize, readErr := errReader.Read(errorMsg)
if readSize > 0 {
log.Warn(string(errorMsg))
- allMsg = append(allMsg, errorMsg...)
+ allMsg = append(allMsg, errorMsg[0:readSize]...)
}
if readErr != nil {
if readErr == io.EOF {