emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r99580: Fix use of unitialized memory


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99580: Fix use of unitialized memory.
Date: Sun, 28 Feb 2010 09:19:31 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99580
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2010-02-28 09:19:31 -0500
message:
  Fix use of unitialized memory.
  
  * charset.c (load_charset_map_from_file)
  (load_charset_map_from_vector): Zero out allocated
  charset_map_entries before using them.
modified:
  src/ChangeLog
  src/charset.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-02-27 14:28:52 +0000
+++ b/src/ChangeLog     2010-02-28 14:19:31 +0000
@@ -1,3 +1,9 @@
+2010-02-28  Chong Yidong  <address@hidden>
+
+       * charset.c (load_charset_map_from_file)
+       (load_charset_map_from_vector): Zero out allocated
+       charset_map_entries before using them.
+
 2010-02-27  Andreas Schwab  <address@hidden>
 
        * w32uniscribe.c (uniscribe_check_otf): Fix length check.

=== modified file 'src/charset.c'
--- a/src/charset.c     2010-02-06 13:23:33 +0000
+++ b/src/charset.c     2010-02-28 14:19:31 +0000
@@ -531,6 +531,7 @@
   SAFE_ALLOCA (head, struct charset_map_entries *,
               sizeof (struct charset_map_entries));
   entries = head;
+  bzero (entries, sizeof (struct charset_map_entries));
 
   n_entries = 0;
   eof = 0;
@@ -557,6 +558,7 @@
          SAFE_ALLOCA (entries->next, struct charset_map_entries *,
                       sizeof (struct charset_map_entries));
          entries = entries->next;
+         bzero (entries, sizeof (struct charset_map_entries));
        }
       idx = n_entries % 0x10000;
       entries->entry[idx].from = from;
@@ -596,6 +598,7 @@
   SAFE_ALLOCA (head, struct charset_map_entries *,
               sizeof (struct charset_map_entries));
   entries = head;
+  bzero (entries, sizeof (struct charset_map_entries));
 
   n_entries = 0;
   for (i = 0; i < len; i += 2)
@@ -632,6 +635,7 @@
          SAFE_ALLOCA (entries->next, struct charset_map_entries *,
                       sizeof (struct charset_map_entries));
          entries = entries->next;
+         bzero (entries, sizeof (struct charset_map_entries));
        }
       idx = n_entries % 0x10000;
       entries->entry[idx].from = from;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]