Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fix bug 3557458 and some compiler warnings #67

wants to merge 3 commits into from

3 participants


SCI_GETSELTEXT also reserves space for a terminating 0 byte, this should not be written to the gpg buffer.
verify_aux.c:163:20: warning: variable 'summary' set but not used [-Wunused-but-set-variable]
encrypt_cb.c:76:17: warning: declaration of 'abort' shadows a global declaration [-Wshadow]
have been fixed.


The diff (actual changes) looks OK, but the the commit are really weird. 35a8fe8 looks like half-merge half-commit; and c28cd25 looks like c9da828 but with additional, unrelated, stuff in it?? I'm not sure how hard it'd be to fix them, but it'd be really great to have proper commits.


Please do a git rebase --interactive and resubmit pull request.


It was a bit tricky to do, mostly because of c28cd25. I did it and I propose #69 as an alternative. Please give it a look and tell me if it looks ok to you.

@alvesh88 I've no clue how this really weird things happened, but you should not be working on the master branch of your fork, but rather in a specific branch. This would avoid such issues where the branch on which you committed diverged, and you can always either merge upstream master or rebase on if from time to time to keep your branch up to date.

E.g., you could create a geanypg-wip branch:

$ git checkout -b geanypg-wip

and when you want to start working on something, go to that branch, either rebase it or merge master (not strictly required but highly recommended), and start working:

$ git checkout geanypg-wip
$ git fetch upstream
$ git rebase upstream/master # or merge upstream/master
$ git commit -a
$ git push origin geanypg-wip # may require -f if you used rebase above

Don't worry about changing the history of that branch, it's specific to your fork and probably not many people would track it. However if you want you can very well use merge rather than rebase, it would only create a few merge commits.

@frlan frlan closed this

Has been merged with pull request #69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 15, 2012
  1. @alvesh88

    Fixed a bug noticed by Goran Andric which caused an error message to

    alvesh88 authored
    appear when encrypting to an untrusted public key.
Commits on Aug 24, 2012
  1. @alvesh88

    Fix bug 3557458 -- when encrypting selected text a 0 byte gets added …

    alvesh88 authored
    …to the text that's being encrypted
  2. @alvesh88

    Fixed compiler warnings

    alvesh88 authored
This page is out of date. Refresh to see the latest.
6 geanypg/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-24 Hans Alves <alves(dot)h88(at)gmail(dot)com>
+* Fixed bug 3557458 which caused a 0 byte to be added to the text
+ when encrypting a selection.
+ Fixed some compiler warnings.
2012-06-04 Hans Alves <alves(dot)h88(at)gmail(dot)com>
* Fixed a bug that caused an error message to appear if one of the
8 geanypg/src/encrypt_cb.c
@@ -73,7 +73,7 @@ void geanypg_encrypt_cb(GtkMenuItem * menuitem, gpointer user_data)
if (geanypg_encrypt_selection_dialog(&ed, &recp, &sign))
int flags = 0;
- int abort = 0;
+ int stop = 0;
gpgme_key_t * key = recp;
while (*key)
@@ -87,13 +87,13 @@ void geanypg_encrypt_cb(GtkMenuItem * menuitem, gpointer user_data)
(*key)->uids->uid, geanypg_validity((*key)->owner_trust)))
- abort = 1;
+ stop = 1;
- if (*recp && !abort)
+ if (*recp && !stop)
geanypg_encrypt(&ed, recp, sign, flags);
- else if (!abort && dialogs_show_question(_("No recipients were selected,\nuse symetric cipher?")))
+ else if (!stop && dialogs_show_question(_("No recipients were selected,\nuse symetric cipher?")))
geanypg_encrypt(&ed, NULL, sign, flags);
if (recp)
4 geanypg/src/helper_functions.c
@@ -137,7 +137,7 @@ void geanypg_load_buffer(gpgme_data_t * buffer)
unsigned long size = 0;
if (sci_has_selection(doc->editor->sci))
- size = scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, 0);
+ size = scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, 0) - 1;
data = (char *) malloc(size + 1);
scintilla_send_message(doc->editor->sci, SCI_GETSELTEXT, 0, (sptr_t)data);
gpgme_data_new_from_mem(buffer, data, size, 1);
@@ -157,7 +157,6 @@ void geanypg_load_buffer(gpgme_data_t * buffer)
void geanypg_write_file(FILE * file)
#define BUFSIZE 2048
unsigned long size;
char buffer[BUFSIZE] = {0};
GeanyDocument * doc = document_get_current();
@@ -177,6 +176,5 @@ void geanypg_write_file(FILE * file)
scintilla_send_message(doc->editor->sci, SCI_APPENDTEXT, (uptr_t) size, (sptr_t) buffer);
#undef BUFSIZE
2  geanypg/src/verify_aux.c
@@ -160,13 +160,11 @@ static char * geanypg_result(gpgme_signature_t sig)
void geanypg_check_sig(encrypt_data * ed, gpgme_signature_t sig)
GtkWidget * dialog;
- gpgme_sigsum_t summary;
char buffer[512] = {0};
char * result;
strncpy(buffer, sig->fpr, 40);
buffer[40] = 0;
geanypg_get_keys_with_fp(ed, buffer);
- summary = sig->summary;
result = geanypg_result(sig);
dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(geany->main_widgets->window),
Something went wrong with that request. Please try again.