]> git.wh0rd.org Git - nano.git/commitdiff
fix potential memory corruption in do_output() when adding UTF-8
authorDavid Lawrence Ramsey <pooka109@gmail.com>
Wed, 5 Jan 2005 15:42:45 +0000 (15:42 +0000)
committerDavid Lawrence Ramsey <pooka109@gmail.com>
Wed, 5 Jan 2005 15:42:45 +0000 (15:42 +0000)
characters, found by valgrind

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2233 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

src/nano.c

index 9a7c35ea9b00a248b7fcc4e33f4729f47371307b..139a29cb627ba878cd8ba213861f77e74f6ab057 100644 (file)
@@ -3643,7 +3643,7 @@ void do_output(int *kbinput, size_t kbinput_len)
 
        /* More dangerousness fun =) */
        current->data = charealloc(current->data,
-               current_len + key_len + 2);
+               current_len + (key_len * 2));
 
        assert(current_x <= current_len);