diff -urNp linux-2.4.21/fs/isofs/rock.c linux-2.4.21.SUSE/fs/isofs/rock.c --- linux-2.4.21/fs/isofs/rock.c 2002-02-25 20:38:08.000000000 +0100 +++ linux-2.4.21.SUSE/fs/isofs/rock.c 2004-03-03 16:54:45.000000000 +0100 @@ -14,6 +14,7 @@ #include #include #include +#include #include "rock.h" @@ -419,7 +420,7 @@ int parse_rock_ridge_inode_internal(stru return 0; } -static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr) +static char *get_symlink_chunk(char *rpnt, struct rock_ridge *rr, char *pstart) { int slen; int rootflag; @@ -431,16 +432,24 @@ static char *get_symlink_chunk(char *rpn rootflag = 0; switch (slp->flags & ~1) { case 0: + if (rpnt - pstart + slp->len >= PAGE_SIZE) + return rpnt; memcpy(rpnt, slp->text, slp->len); rpnt+=slp->len; break; case 4: + if (rpnt - pstart + 1 >= PAGE_SIZE) + return rpnt; *rpnt++='.'; /* fallthru */ case 2: + if (rpnt - pstart + 1 >= PAGE_SIZE) + return rpnt; *rpnt++='.'; break; case 8: + if (rpnt - pstart + 1 >= PAGE_SIZE) + return rpnt; rootflag = 1; *rpnt++='/'; break; @@ -457,7 +466,9 @@ static char *get_symlink_chunk(char *rpn * If there is another SL record, and this component * record isn't continued, then add a slash. */ - if ((!rootflag) && (rr->u.SL.flags & 1) && !(oldslp->flags & 1)) + if ((!rootflag) && (rr->u.SL.flags & 1) && + !(oldslp->flags & 1) && + rpnt - pstart + 1 < PAGE_SIZE) *rpnt++='/'; break; } @@ -465,7 +476,8 @@ static char *get_symlink_chunk(char *rpn /* * If this component record isn't continued, then append a '/'. */ - if (!rootflag && !(oldslp->flags & 1)) + if (!rootflag && !(oldslp->flags & 1) && + rpnt - pstart + 1 < PAGE_SIZE) *rpnt++='/'; } @@ -548,7 +560,7 @@ static int rock_ridge_symlink_readpage(s CHECK_SP(goto out); break; case SIG('S', 'L'): - rpnt = get_symlink_chunk(rpnt, rr); + rpnt = get_symlink_chunk(rpnt, rr, link); break; case SIG('C', 'E'): /* This tells is if there is a continuation record */