aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/object')
-rw-r--r--plumbing/object/tree.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go
index e9f7666..7fe773d 100644
--- a/plumbing/object/tree.go
+++ b/plumbing/object/tree.go
@@ -280,6 +280,9 @@ func (t *Tree) Encode(o plumbing.EncodedObject) (err error) {
defer ioutil.CheckClose(w, &err)
for _, entry := range t.Entries {
+ if strings.IndexByte(entry.Name, 0) != -1 {
+ return fmt.Errorf("malformed filename %q", entry.Name)
+ }
if _, err = fmt.Fprintf(w, "%o %s", entry.Mode, entry.Name); err != nil {
return err
}