[geany/geany-plugins] 195f5a: GeanyPG: Initialize local arrays for better safety

Colomban Wendling git-noreply at xxxxx
Sun Jul 8 11:22:41 UTC 2012


Branch:      refs/heads/1.22_release
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sun, 08 Jul 2012 11:22:41
Commit:      195f5a30ad5a3796cc4a820605712750bf807fd6
             https://github.com/geany/geany-plugins/commit/195f5a30ad5a3796cc4a820605712750bf807fd6

Log Message:
-----------
GeanyPG: Initialize local arrays for better safety


Modified Paths:
--------------
    geanypg/src/pinentry.c
    geanypg/src/verify_aux.c

Modified: geanypg/src/pinentry.c
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -73,7 +73,7 @@ gpgme_error_t geanypg_passphrase_cb(void * hook,
     int inpipe[2];
     int childpid;
     int status;
-    char readbuffer[2080]; /* pinentry should at least support passphrases of up to 2048 characters */
+    char readbuffer[2080] = {0}; /* pinentry should at least support passphrases of up to 2048 characters */
     FILE * childin;
 
     if (pipe(outpipe))


Modified: geanypg/src/verify_aux.c
10 files changed, 5 insertions(+), 5 deletions(-)
===================================================================
@@ -48,7 +48,7 @@ static void geanypg_get_keys_with_fp(encrypt_data * ed, char * buffer)
                     sprintf(buffer, "%s <%s>", name, email);
                 else
                 {
-                    char tmp[62];
+                    char tmp[62] = {0};
                     strncpy(tmp, buffer, 41);
                     sprintf(buffer, "%s %s", _("a key with fingerprint"), tmp);
                 }
@@ -107,11 +107,11 @@ static char * geanypg_result(gpgme_signature_t sig)
       "other flags:%s%s\n"
       "notations .: %s\n");
     char * buffer;
-    char summary[128];
+    char summary[128] = {0};
     const char * pubkey = gpgme_pubkey_algo_name(sig->pubkey_algo);
     const char * hash = gpgme_hash_algo_name(sig->hash_algo);
-    char created[64];
-    char expires[64];
+    char created[64] = {0};
+    char expires[64] = {0};
     size_t buffer_size;
     if (sig->timestamp)
         strncpy(created, ctime((time_t*)&sig->timestamp), 64);
@@ -161,7 +161,7 @@ void geanypg_check_sig(encrypt_data * ed, gpgme_signature_t sig)
 {
     GtkWidget * dialog;
     gpgme_sigsum_t summary;
-    char buffer[512];
+    char buffer[512] = {0};
     char * result;
     strncpy(buffer, sig->fpr, 40);
     buffer[40] = 0;


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Plugins-Commits mailing list