Mark Brown wrote:
On Sun, Jan 20, 2008 at 02:45:08PM -0500, Ron Murray wrote:
I think the following code should fix it (at least, it protects
against out-of-array-bounds problems):
Thanks.
Could you please resend this patch as a unified diff (ie: 'diff -u orig
new')? patch cannot apply the patch, complaining of an unexpected end
of file and I unfortunately find it difficult to read the particular
format you're using here. It's a good idea to use the unified diff
format when submitting patches to free software projects - it is the
standard format and is more robust against corruption or changes in the
underlying source code.
Attached. Sorry about that: I assumed patch would cope with a context
diff, but perhaps not.
Note that I'm not sure if this will fix the original bug or not, but
it does address the segfault that I got, and certainly that part of the
code did need fixing. I noticed that the code handling the 0xa0 - 0xa1
cases had been commented out, but I don't see why. It seemed safer to
put it back in.
.....Ron
--
Ron Murray ([EMAIL PROTECTED])
http://www.rjmx.net/~ron
GPG Public Key Fingerprint:
F2C1 FC47 5EF7 0317 133C D66B 8ADA A3C4 D86C 74DE
It's easy to apply yourself, just use crazy glue!
--- dmi.c.orig 2003-07-06 19:03:05.000000000 -0400
+++ dmi.c 2008-01-20 13:37:16.000000000 -0500
@@ -104,12 +104,15 @@
"8251 FIFO Compatible",
};
- if(code == 0xFF)
+ if (code == 0xFF)
return "Other";
- if (code <= 0xA1)
- return port_type[code];
+ /* Special case for floppies */
+ if ((code >= 0xA0) && (code <= 0xA1))
+ return port_type[(code - 0xA0) + 0x20];
+ if (code <= (sizeof(port_type) / sizeof(char *)))
+ return port_type[code];
/*
if (code <= 0x1F)
return port_type[code];