[svn] gpgme - r1341 - trunk/gpgme

svn author wk cvs at cvs.gnupg.org
Fri Oct 24 16:07:15 CEST 2008


Author: wk
Date: 2008-10-24 16:07:14 +0200 (Fri, 24 Oct 2008)
New Revision: 1341

Modified:
   trunk/gpgme/ChangeLog
   trunk/gpgme/rungpg.c
Log:
Fix last change.


Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog	2008-10-23 10:51:31 UTC (rev 1340)
+++ trunk/gpgme/ChangeLog	2008-10-24 14:07:14 UTC (rev 1341)
@@ -1,3 +1,7 @@
+2008-10-24  Werner Koch  <wk at g10code.com>
+
+	* rungpg.c (gpg_keylist_preprocess): Escape backslashes too.
+
 2008-10-23  Marcus Brinkmann  <marcus at g10code.de>
 
 	* rungpg.c (gpg_keylist_preprocess): Convert percent escaped

Modified: trunk/gpgme/rungpg.c
===================================================================
--- trunk/gpgme/rungpg.c	2008-10-23 10:51:31 UTC (rev 1340)
+++ trunk/gpgme/rungpg.c	2008-10-24 14:07:14 UTC (rev 1341)
@@ -1884,9 +1884,8 @@
       {
 	/* The user ID is percent escaped, but we want c-coded.
 	   Because we have to replace each '%HL' by '\xHL', we need at
-	   most 4/3 th the number of bytes.  But because this 
-	   security software, we err on the good side and allocate
-	   twice as much.  */
+	   most 4/3 th the number of bytes.  But because we also need
+	   to escape the backslashes we allocate twice as much.  */
 	char *uid = malloc (2 * strlen (field[1]) + 1);
 	char *src;
 	char *dst;
@@ -1902,14 +1901,17 @@
 		*(dst++) = '\\';
 		*(dst++) = 'x';
 		src++;
-		/* Copy the next two bytes unconditionally.  This is
-		   what reduces the maximum number of needed bytes
-		   from 2n+1 to (4/3)n+1, even for invalid strings.  */
+		/* Copy the next two bytes unconditionally.  */
 		if (*src)
 		  *(dst++) = *(src++);
 		if (*src)
 		  *(dst++) = *(src++);
 	      }
+	    else if (*src == '\\')
+              {
+                *dst++ = '\\';
+                *dst++ = '\\';
+              }
 	    else
 	      *(dst++) = *(src++);
 	  }




More information about the Gnupg-commits mailing list