mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-14 08:13:25 +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
a9445bbb1d
commit
8968e84903
@ -527,7 +527,11 @@ recsel_select (recsel_expr_t selector,
|
||||
if (recsel_debug)
|
||||
log_debug ("%s: name=%s got value '%s'\n", __func__, se->name, value);
|
||||
if (!value)
|
||||
value = "";
|
||||
{
|
||||
se = se->next;
|
||||
result = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!*value)
|
||||
{
|
||||
|
@ -324,7 +324,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");
|
||||
@ -352,7 +352,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");
|
||||
@ -387,7 +387,8 @@ run_test_2 (void)
|
||||
fail (0, 0);
|
||||
|
||||
FREEEXPR();
|
||||
ADDEXPR ("letter -f");
|
||||
ADDEXPR ("letters -f");
|
||||
recsel_dump (se);
|
||||
if (!recsel_select (se, test_2_getval, NULL))
|
||||
fail (0, 0);
|
||||
FREEEXPR();
|
||||
|
Loading…
x
Reference in New Issue
Block a user