commit c4e6bf40dc7c46f8d217de9fdede1d6a63e1e26c
parent 353c8d8fec597469da337e93dd922df980fb5d9e
Author: sin <sin@2f30.org>
Date: Tue, 30 Apr 2013 17:47:10 +0100
check magic
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/bdec/bdec.go b/src/bdec/bdec.go
@@ -61,6 +61,10 @@ func main() {
log.Fatal(err)
}
+ if h.Magic != "BENC" {
+ log.Fatal(fmt.Errorf("Invalid magic: %s", h.Magic).Error())
+ }
+
db := decryptBuf(c, h.Data)
fmt.Printf("%s", db[0:h.Len])
}
diff --git a/src/benc/benc.go b/src/benc/benc.go
@@ -64,7 +64,7 @@ func main() {
}
eb := encryptBuf(c, b)
- h := &hdr{"benc", uint64(len(b)), eb}
+ h := &hdr{"BENC", uint64(len(b)), eb}
g := gob.NewEncoder(os.Stdout)
err = g.Encode(*h)
if err != nil {