Fedor Vorobev via Postfix-devel:
> Hello,
> 
> it seems that in dict_db, if DB->cursor() fails for any reason,
> postfix would end up dereferencing a NULL pointer.
> 
> Maybe worth adding a check so that the error is logged at least. 

Allright. Just in time before a Postfix release.

        Wietse
> Cheers,
> Fedor
> 
> ---
>  src/util/dict_db.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/dict_db.c b/src/util/dict_db.c
> index 053db3c..4c714fa 100644
> --- a/src/util/dict_db.c
> +++ b/src/util/dict_db.c
> @@ -446,8 +446,10 @@ static int dict_db_sequence(DICT *dict, int function,
>       */
>      switch (function) {
>      case DICT_SEQ_FUN_FIRST:
> -     if (dict_db->cursor == 0)
> -         DICT_DB_CURSOR(db, &(dict_db->cursor));
> +     if (dict_db->cursor == 0) {
> +         if ((status = DICT_DB_CURSOR(db, &(dict_db->cursor))) != 0)
> +             msg_fatal("error [%d] initializing cursor for %s: %m", status, 
> dict_db->dict.name);
> +     }
>       db_function = DB_FIRST;
>       break;
>      case DICT_SEQ_FUN_NEXT:
> -- 
> 2.53.0
> 
> _______________________________________________
> Postfix-devel mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> 
_______________________________________________
Postfix-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to