Incorrect indexing into character name list
authorMichael Gran <spk121@yahoo.com>
Mon, 28 Dec 2009 02:44:29 +0000 (18:44 -0800)
committerMichael Gran <spk121@yahoo.com>
Mon, 28 Dec 2009 02:44:29 +0000 (18:44 -0800)
When converting a character into a character name, an incorrect
character name could theoretically have been returned.

* libguile/chars.c (scm_i_charname): used wrong index into
  scm_alt_charnames

libguile/chars.c

index 16a2b90..49c1ea3 100644 (file)
@@ -577,9 +577,11 @@ scm_i_charname (SCM chr)
     if (scm_C0_control_charnums[c] == i)
       return scm_C0_control_charnames[c];
 
+  /* Since the characters in scm_alt_charnums is a subset of
+     scm_C0_control_charnums, this code is never reached.  */
   for (c = 0; c < SCM_N_ALT_CHARNAMES; c++)
     if (scm_alt_charnums[c] == i)
-      return scm_alt_charnames[i];
+      return scm_alt_charnames[c];
 
   return NULL;
 }