[Pkg-gnupg-commit] [gnupg2] 117/241: common: Fix commit f99830b.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 20:32:04 UTC 2015


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 20125333e7b822e8c70ac8cef986649f0654eb56
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Nov 6 13:20:01 2015 +0100

    common: Fix commit f99830b.
    
    * common/userids.c (classify_user_id): Avoid underflow.  Use spacep to
    also trim tabs.
    --
    
    This is actually not fully consistent because the now used
    trim_trailing_spaces uses the locale dependent isspace and not spacep.
    Given that the use of isspace is anyway problematic we should check
    whether we can chnage trim_trailing_spaces.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 common/userids.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/common/userids.c b/common/userids.c
index 25d6741..f9a0036 100644
--- a/common/userids.c
+++ b/common/userids.c
@@ -89,11 +89,15 @@ classify_user_id (const char *name, KEYDB_SEARCH_DESC *desc, int openpgp_hack)
   /* Skip leading and trailing spaces.  */
   for(s = name; *s && spacep (s); s++ )
     ;
-  if (s[strlen(s) - 1] == ' ')
+  if (*s && spacep (s + strlen(s) - 1))
     {
-      s2 = xstrdup (s);
-      while (s2[strlen(s2) - 1] == ' ')
-        s2[strlen(s2) - 1] = 0;
+      s2 = xtrystrdup (s);
+      if (!s2)
+        {
+          rc = gpg_error_from_syserror ();
+          goto out;
+        }
+      trim_trailing_spaces (s2);
       s = s2;
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list