mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
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@gnupg.org>
This commit is contained in:
parent
28e198201e
commit
20125333e7
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user