[grisbi-cvs] [SCM] grisbi branch, master, updated. upstream_version_0_7_99-46-g713ecb8

Rémi Cardona nobody at users.sourceforge.net
Mon Feb 7 08:11:53 CET 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grisbi".

The branch, master has been updated
       via  713ecb87bb51fe5cd275c635e39d8efad511689b (commit)
      from  90c75437a4e4042ec981f498cfc89851601d7658 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 713ecb87bb51fe5cd275c635e39d8efad511689b
Author: Rémi Cardona <remi at gentoo.org>
Date:   Mon Feb 7 08:10:26 2011 +0100

    openssl: make sure we have a trailing null byte at the end of decrypted file buffers
    
    If (file size - 22) % 8 == 0, the output buffer doesn't contain a null byte
    at the end. So we add one in all case, to be 100% safe.

-----------------------------------------------------------------------

Changes:
diff --git a/src/plugins/openssl/openssl.c b/src/plugins/openssl/openssl.c
index 243745d..32777dc 100644
--- a/src/plugins/openssl/openssl.c
+++ b/src/plugins/openssl/openssl.c
@@ -148,9 +148,9 @@ decrypt_v2(gchar *password, gchar **file_content, gulong length)
     }
 
     /* Copy the decrypted data to a final buffer, leaving out the second
-     * marker. */
+     * marker. g_strndup() is used to add a trailing null byte. */
     output_len = decrypted_len - V2_MARKER_SIZE;
-    output_buf = g_memdup ( decrypted_buf + V2_MARKER_SIZE, output_len );
+    output_buf = g_strndup ( decrypted_buf + V2_MARKER_SIZE, output_len );
 
     g_free ( decrypted_buf );
 
@@ -171,9 +171,10 @@ decrypt_v1(gchar *password, gchar **file_content, gulong length)
     gchar *decrypted_buf;
 
     /* Create a temporary buffer that will hold the decrypted data without the
-     * marker. */
+     * marker. A trailing null byte is also added. */
     decrypted_len = length - V1_MARKER_SIZE;
-    decrypted_buf = g_malloc ( decrypted_len );
+    decrypted_buf = g_malloc ( decrypted_len + 1 );
+    decrypted_buf[decrypted_len] = 0;
 
     DES_string_to_key ( password, &key );
     DES_set_key_unchecked( &key, &sched );


hooks/post-receive
-- 
grisbi


More information about the cvs mailing list