fix real cause of iso name truncation

This commit is contained in:
cinap_lenrek 2011-06-06 04:56:50 +00:00
parent 0fda678227
commit 9310110448
3 changed files with 11 additions and 16 deletions

2
sys/lib/dist/mkfile vendored
View file

@ -4,6 +4,6 @@ cd:V: /tmp/9front.iso
%.iso: pc/plan9.ini.cd
bind /n/src9 /n/src9/dist/plan9front
bind pc/plan9.ini.cd /n/src9/cfg/plan9.ini
disk/mk9660 -9j -B 386/9bootiso -p /n/src9/sys/lib/sysconfig/proto/cdproto -s /n/src9 -v 'Plan 9 Front' $target
disk/mk9660 -c9j -B 386/9bootiso -p /n/src9/sys/lib/sysconfig/proto/cdproto -s /n/src9 -v 'Plan 9 Front' $target
unmount /n/src9/cfg/plan9.ini
unmount /n/src9/dist/plan9front

View file

@ -569,7 +569,6 @@ rzdir(Xfs *fs, Dir *d, int fmt, Drec *dp)
char buf[Maxname+UTFmax+1];
uchar *q;
Rune r;
enum { ONAMELEN = 28 }; /* old Plan 9 directory name length */
have = 0;
flags = 0;
@ -622,23 +621,23 @@ rzdir(Xfs *fs, Dir *d, int fmt, Drec *dp)
* from plan9 directory extension
*/
nl = *s;
if(nl >= ONAMELEN)
nl = ONAMELEN-1;
if(nl >= Maxname)
nl = Maxname-1;
if(nl) {
memset(d->name, 0, ONAMELEN);
memset(d->name, 0, Maxname);
memmove(d->name, s+1, nl);
}
s += 1 + *s;
nl = *s;
if(nl >= ONAMELEN)
nl = ONAMELEN-1;
memset(d->uid, 0, ONAMELEN);
if(nl >= Maxname)
nl = Maxname-1;
memset(d->uid, 0, Maxname);
memmove(d->uid, s+1, nl);
s += 1 + *s;
nl = *s;
if(nl >= ONAMELEN)
nl = ONAMELEN-1;
memset(d->gid, 0, ONAMELEN);
if(nl >= Maxname)
nl = Maxname-1;
memset(d->gid, 0, Maxname);
memmove(d->gid, s+1, nl);
s += 1 + *s;
if(((uintptr)s) & 1)

View file

@ -195,8 +195,7 @@ Creadblock(Cdimg *cd, void *buf, ulong block, ulong len)
int
parsedir(Cdimg *cd, Direc *d, uchar *buf, int len, char *(*cvtname)(uchar*, int))
{
enum { NAMELEN = 28 };
char name[NAMELEN];
char name[256];
uchar *p;
Cdir *c;
@ -230,7 +229,6 @@ parsedir(Cdimg *cd, Direc *d, uchar *buf, int len, char *(*cvtname)(uchar*, int)
if((p-buf)&1)
p++;
assert(p < buf+c->len);
assert(*p < NAMELEN);
if(*p != 0) {
memmove(name, p+1, *p);
name[*p] = '\0';
@ -238,12 +236,10 @@ parsedir(Cdimg *cd, Direc *d, uchar *buf, int len, char *(*cvtname)(uchar*, int)
d->name = atom(name);
}
p += *p+1;
assert(*p < NAMELEN);
memmove(name, p+1, *p);
name[*p] = '\0';
d->uid = atom(name);
p += *p+1;
assert(*p < NAMELEN);
memmove(name, p+1, *p);
name[*p] = '\0';
d->gid = atom(name);