summary refs log tree commit diff
path: root/iconv/gconv_cache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-24 18:49:46 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-24 18:49:46 +0000
commitee6a43e5f0edaff98517a5bc23873af7253d8a38 (patch)
tree11d56fa8a729266b23ffa6371862d1b21646c2d7 /iconv/gconv_cache.c
parent73de87b622b37e1ce39d51384bc19e1c3746fbf4 (diff)
downloadglibc-ee6a43e5f0edaff98517a5bc23873af7253d8a38.tar.gz
glibc-ee6a43e5f0edaff98517a5bc23873af7253d8a38.tar.xz
glibc-ee6a43e5f0edaff98517a5bc23873af7253d8a38.zip
(__gconv_lookup_cache): Catch one more boundary case and reject it.
Diffstat (limited to 'iconv/gconv_cache.c')
-rw-r--r--iconv/gconv_cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/iconv/gconv_cache.c b/iconv/gconv_cache.c
index 20a30b6fdf..79e5dde629 100644
--- a/iconv/gconv_cache.c
+++ b/iconv/gconv_cache.c
@@ -324,11 +324,12 @@ __gconv_lookup_cache (const char *toset, const char *fromset,
  try_internal:
   /* See whether we can convert via the INTERNAL charset.  */
   if ((fromidx != 0 && __builtin_expect (from_module->fromname_offset, 1) == 0)
-      || (toidx != 0 && __builtin_expect (to_module->toname_offset, 1) == 0))
+      || (toidx != 0 && __builtin_expect (to_module->toname_offset, 1) == 0)
+      || (fromidx == 0 && toidx == 0))
     /* Not possible.  Nothing we can do.  */
     return __GCONV_NOCONV;
 
-  /* Use the two modules.  */
+  /* We will use up to two modules.  Always allocate room for two.  */
   result = (struct __gconv_step *) malloc (2 * sizeof (struct __gconv_step));
   if (result == NULL)
     return __GCONV_NOMEM;