[PATCH v2] erofs-utils: lib: fix potential NULL pointer dereference in docker_config.c
Utkal Singh
singhutkal015 at gmail.com
Thu Mar 19 00:22:47 AEDT 2026
Hi Sri Lasya,
Thanks for the v2.
The fix looks correct. In the original code, if
json_object_iter_peek_value() returned NULL (iterator at end),
calling continue without first advancing via json_object_iter_next()
would result in an infinite loop on the same invalid position.
This patch correctly advances the iterator before continuing, which
prevents that scenario.
Thanks ,
Utkal Singh <singhutkal015 at gmail.com>
On Mon, 16 Mar 2026 at 14:23, <lasyaprathipati at gmail.com> wrote:
> From: Sri Lasya <lasyaprathipati at gmail.com>
>
> ---
> lib/remotes/docker_config.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/remotes/docker_config.c b/lib/remotes/docker_config.c
> index b346ee8..6401c1b 100644
> --- a/lib/remotes/docker_config.c
> +++ b/lib/remotes/docker_config.c
> @@ -202,8 +202,10 @@ int erofs_docker_config_lookup(const char *registry,
> }
>
> entry = json_object_iter_peek_value(&it);
> - if (!entry)
> + if (!entry) {
> + json_object_iter_next(&it);
> continue;
> + }
> if (json_object_object_get_ex(entry, "auth", &auth_field))
> {
> b64 = json_object_get_string(auth_field);
> if (b64 && *b64) {
> --
> 2.43.0
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linux-erofs/attachments/20260318/b60d59e9/attachment.htm>
More information about the Linux-erofs
mailing list