mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-24 16:43:28 +02:00
common: Fix logic for certain recsel conditions.
* common/recsel.c (recsel_select): Change processing of NULL values. * common/t-recsel.c (run_test_2): Adjust for this change. Also a type fix for s/"letter"/"letters"/. -- The getval function may return NULL which indicates that there is no useful value available. For example because the propertyname is not defined for some external context (e.g. in gpg the packet type). This also required to fix the test for boolean tests of a non existing property name. Reported-by: shniubobo at gnupg-users on 2025-04-18.
This commit is contained in:
parent
9b7c067717
commit
3ea8cab6a4
@ -506,7 +506,11 @@ recsel_select (recsel_expr_t selector,
|
||||
{
|
||||
value = getval? getval (cookie, se->name) : NULL;
|
||||
if (!value)
|
||||
value = "";
|
||||
{
|
||||
se = se->next;
|
||||
result = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!*value)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ run_test_2 (void)
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("nothing -z");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
if (recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("nothing -n");
|
||||
@ -334,7 +334,7 @@ run_test_2 (void)
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("nothing -f");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
if (recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
ADDEXPR ("nothing -t");
|
||||
@ -369,7 +369,7 @@ run_test_2 (void)
|
||||
fail (0, 0);
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("letter -f");
|
||||
ADDEXPR ("letters -f");
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
|
Loading…
x
Reference in New Issue
Block a user