When searching for keys, and the user supplies "" to match against,
pgp_getkeybystr will have values:
p = "";
l = 0;
After returning from pgp_select_key(), it will try to assign to
p[l-1].
(As a note, the function is chopping off and restoring the trailing
"!" character because of ticket #1928.)
pgp_remove_key (&matches, k);
pgp_free_key (&matches);
- if (!p[l-1])
+ if (l && !p[l-1])
p[l-1] = '!';
return k;
}
out:
- if (!p[l-1])
+ if (l && !p[l-1])
p[l-1] = '!';
return NULL;
}