HPFS patch

From: Pavel Machek (pavel@suse.cz)
Date: Sat Aug 12 2000 - 13:43:54 EST


Hi!

This diff is neccessary unless you want to access out-of-bounds on
japanese version of OS/2. Please
apply. (mikulas@artax.karlin.mff.cuni.cz is original author).

                                                        Pavel
PS: Tytso, add this to list of fixes needed, if you are reading this.

Content-Description: patch
--- linux/fs/hpfs/hpfs.h_ Wed Jun 21 22:17:43 2000
+++ linux/fs/hpfs/hpfs.h Wed Jun 21 22:24:26 2000
@@ -187,7 +187,9 @@
                                            in data block */
     secno code_page_data; /* sector number of a code_page_data
                                            containing c.p. array */
- unsigned index; /* index in c.p. array in that sector*/
+ unsigned short index; /* index in c.p. array in that sector*/
+ unsigned short unknown; /* some unknown value; usually 0;
+ 2 in Japanese version */
   } array[31]; /* unknown length */
 };
 
@@ -207,7 +209,7 @@
   struct {
     unsigned short ix; /* index */
     unsigned short code_page_number; /* code page number */
- unsigned short zero1;
+ unsigned short unknown; /* the same as in cp directory */
     unsigned char map[128]; /* upcase table for chars 80..ff */
     unsigned short zero2;
   } code_page[3];
--- linux/fs/hpfs/map.c_ Wed Jun 21 22:17:47 2000
+++ linux/fs/hpfs/map.c Wed Jun 21 22:23:35 2000
@@ -59,6 +59,11 @@
         cpds = cp->array[0].code_page_data;
         cpi = cp->array[0].index;
         brelse(bh);
+
+ if (cpi >= 3) {
+ printk("HPFS: Code page index out of array\n");
+ return NULL;
+ }
         
         if (!(cpd = hpfs_map_sector(s, cpds, &bh, 0))) return NULL;
         if ((unsigned)cpd->offs[cpi] > 0x178) {

-- 
I'm pavel@ucw.cz. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at discuss@linmodems.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:30 EST