Commit 67460650 authored by David du Colombier's avatar David du Colombier

syscall: disallow slashes in file names on Plan 9

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/43480050
parent 93e4a9d8
......@@ -11,6 +11,7 @@ import "errors"
var (
ErrShortStat = errors.New("stat buffer too short")
ErrBadStat = errors.New("malformed stat buffer")
ErrBadName = errors.New("bad character in file name")
)
// A Qid represents a 9P server's unique identification for a file.
......@@ -65,6 +66,12 @@ func (d *Dir) Marshal(b []byte) (n int, err error) {
return n, ErrShortStat
}
for _, c := range d.Name {
if c == '/' {
return n, ErrBadName
}
}
b = pbit16(b, uint16(n)-2)
b = pbit16(b, d.Type)
b = pbit32(b, d.Dev)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment