[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] [ANNOUNCE] FreeMiNT 1.17.0 Released !



On Thu, 2010-12-30 at 23:07 +0100, Jo Even Skarstein wrote:

> I think I found the bug. keytab_size was not set correctly in
> load_external_table(), which caused sys_b_bioskeys() to miss the last
> byte when copying the table. It seems to work fine now. Will remove all
> my debug-stuff and submit a patch.

Here's the patch. I fixed the bug in helmut-enhancements as I can't
compile trunk with gcc 2.95. Description:

"Fixed a bug where the keyboard table was not correctly copied when
loaded from disk."

Jo Even
--- helmut-enhancements.cvs/sys/keyboard.c	Mon Sep 27 22:51:56 2010
+++ helmut-enhancements/sys/keyboard.c	Fri Dec 31 00:27:04 2010
@@ -1546,14 +1546,14 @@
 		return EFTYPE;
 	}
 
-	kbuf = kmalloc(size+2); /* Append a zero (if the table is missing the altgr + deadkey part) */
+	kbuf = kmalloc(size+2); /* Append two zeros in case the altgr + deadkey tables are missing from the file. */
 	if (!kbuf)
 	{
 		DEBUG(("%s(): out of memory", __FUNCTION__));
 		return ENOMEM;
 	}
 
-	mint_bzero(kbuf, size+2);
+	mint_bzero(kbuf, size+2); /* Don't forget to clear the buffer in case the file is missing any tables. */
 
 	if ((*fp->dev->read)(fp, (char *)kbuf, size) == size)
 	{
@@ -1629,7 +1629,7 @@
 		kfree(keytab_buffer);
 
 	keytab_buffer = (char *)kbuf;
-	keytab_size = size+1;
+	keytab_size = size+2;
 
 	TRACE(("%s(): keytab_size %ld", __FUNCTION__, keytab_size));