]> ruderich.org/simon Gitweb - nsscash/nsscash.git/blobdiff - passwd.go
nsscash: improve index sanity check
[nsscash/nsscash.git] / passwd.go
index c07e9c73914d378d8964756994542f92eeefb3b1..1b4939c63ac6a1a9b2c634bdd0a74a2def5f0419 100644 (file)
--- a/passwd.go
+++ b/passwd.go
@@ -191,7 +191,8 @@ func SerializePasswds(w io.Writer, pws []Passwd) error {
        }
 
        // Sanity check
-       if indexOrig.Len() != indexId.Len() ||
+       if len(pws)*8 != indexOrig.Len() ||
+               indexOrig.Len() != indexId.Len() ||
                indexId.Len() != indexName.Len() {
                return fmt.Errorf("indexes have inconsistent length")
        }