[git] Pinentry - branch, master, updated. pinentry-0.9.6-6-gf143d21

by Dirk Mueller cvs at cvs.gnupg.org
Thu Oct 22 10:58:27 CEST 2015


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 "The standard pinentry collection".

The branch, master has been updated
       via  f143d216eff4eac3f05a85640b9f91431aec5588 (commit)
      from  48ab8cdccff4eefec4d8fa2e23b933c2277bc30c (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 f143d216eff4eac3f05a85640b9f91431aec5588
Author: Dirk Mueller <dirk at dmllr.de>
Date:   Wed Oct 21 14:41:53 2015 +0200

    Qt: Do not use temporary reference to utf8 pin
    
    * qt/main.cpp (qt_cmd_handler): Keep utf8 pin byte array.
    
    --
    The pin pointer was invalid after the UTF8 conversion
    as the converted byte array only was temporary in that
    call and the data pointer becomes invalid after it's
    destruction.
    
    Commit message amended by Andre Heinecke. The original
    commit message was:
    
    const char* does not keep the temporary string returned
    from toUtf8() active, since it doesn't keep the reference counter
    set. So you usually just copy out garbage instead of the
    pin that was entered. Just keep the QByteArray which keeps
    the reference active.
    
    GnuPG-bug-id: 2133

diff --git a/qt/main.cpp b/qt/main.cpp
index 70e08de..c7518fa 100644
--- a/qt/main.cpp
+++ b/qt/main.cpp
@@ -190,15 +190,15 @@ qt_cmd_handler (pinentry_t pe)
       if (!ret)
 	return -1;
 
-      const char *pin = pinentry.pin().toUtf8().constData();
+      QByteArray pin = pinentry.pin().toUtf8 ();
 
-      int len = strlen (pin);
+      int len = strlen (pin.constData ());
       if (len >= 0)
 	{
 	  pinentry_setbufferlen (pe, len + 1);
 	  if (pe->pin)
 	    {
-	      strcpy (pe->pin, pin);
+	      strcpy (pe->pin, pin.constData ());
 	      return len;
 	    }
 	}

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

Summary of changes:
 qt/main.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list