Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: lib: fix potential NULL pointer dereference in docker_config.c
@ 2026-03-15 19:14 Sri Lasya
  2026-03-16  4:35 ` Gao Xiang
  0 siblings, 1 reply; 3+ messages in thread
From: Sri Lasya @ 2026-03-15 19:14 UTC (permalink / raw)
  To: linux-erofs; +Cc: gaoxiang25, Sri Lasya

Signed-off-by: Sri Lasya <lasyaprathipati@gmail.com>
---
 lib/remotes/docker_config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/remotes/docker_config.c b/lib/remotes/docker_config.c
index 00db1bb..b346ee8 100644
--- a/lib/remotes/docker_config.c
+++ b/lib/remotes/docker_config.c
@@ -38,7 +38,6 @@ static char *docker_config_path(void)
 {
 	const char *dir;
 	char *path = NULL;
-
 	dir = getenv("DOCKER_CONFIG");
 	if (dir) {
 		if (!*dir)
@@ -203,6 +202,8 @@ int erofs_docker_config_lookup(const char *registry,
 		}
 
 		entry = json_object_iter_peek_value(&it);
+                if (!entry)
+			continue;
 		if (json_object_object_get_ex(entry, "auth", &auth_field)) {
 			b64 = json_object_get_string(auth_field);
 			if (b64 && *b64) {
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] erofs-utils: lib: fix potential NULL pointer dereference in docker_config.c
  2026-03-15 19:14 [PATCH] erofs-utils: lib: fix potential NULL pointer dereference in docker_config.c Sri Lasya
@ 2026-03-16  4:35 ` Gao Xiang
  2026-03-16  9:01   ` Sri Lasya Prathipati
  0 siblings, 1 reply; 3+ messages in thread
From: Gao Xiang @ 2026-03-16  4:35 UTC (permalink / raw)
  To: Sri Lasya, linux-erofs, ChengyuZhu6; +Cc: gaoxiang25



On 2026/3/16 03:14, Sri Lasya wrote:
> Signed-off-by: Sri Lasya <lasyaprathipati@gmail.com>
> ---
>   lib/remotes/docker_config.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/remotes/docker_config.c b/lib/remotes/docker_config.c
> index 00db1bb..b346ee8 100644
> --- a/lib/remotes/docker_config.c
> +++ b/lib/remotes/docker_config.c
> @@ -38,7 +38,6 @@ static char *docker_config_path(void)
>   {
>   	const char *dir;
>   	char *path = NULL;
> -
>   	dir = getenv("DOCKER_CONFIG");
>   	if (dir) {
>   		if (!*dir)
> @@ -203,6 +202,8 @@ int erofs_docker_config_lookup(const char *registry,
>   		}
>   
>   		entry = json_object_iter_peek_value(&it);
> +                if (!entry)
> +			continue;

The patch format is broken, also Chengyu could you review it?

Thanks,
Gao Xiang

>   		if (json_object_object_get_ex(entry, "auth", &auth_field)) {
>   			b64 = json_object_get_string(auth_field);
>   			if (b64 && *b64) {



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] erofs-utils: lib: fix potential NULL pointer dereference in docker_config.c
  2026-03-16  4:35 ` Gao Xiang
@ 2026-03-16  9:01   ` Sri Lasya Prathipati
  0 siblings, 0 replies; 3+ messages in thread
From: Sri Lasya Prathipati @ 2026-03-16  9:01 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs, ChengyuZhu6, gaoxiang25

Hi Gao,

Thank you for the feedback. I apologize for the formatting issues in
the first version.

I have sent a [PATCH v2] via git send-email to ensure the tabs and
formatting are preserved correctly. In the second version, I also
added an iterator increment to prevent a potential infinite loop when
an entry is NULL.

Hi Chengyu, please review the V2 version instead.

Best regards,
Sri Lasya

On Mon, Mar 16, 2026 at 10:05 AM Gao Xiang <hsiangkao@linux.alibaba.com> wrote:
>
>
>
> On 2026/3/16 03:14, Sri Lasya wrote:
> > Signed-off-by: Sri Lasya <lasyaprathipati@gmail.com>
> > ---
> >   lib/remotes/docker_config.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/remotes/docker_config.c b/lib/remotes/docker_config.c
> > index 00db1bb..b346ee8 100644
> > --- a/lib/remotes/docker_config.c
> > +++ b/lib/remotes/docker_config.c
> > @@ -38,7 +38,6 @@ static char *docker_config_path(void)
> >   {
> >       const char *dir;
> >       char *path = NULL;
> > -
> >       dir = getenv("DOCKER_CONFIG");
> >       if (dir) {
> >               if (!*dir)
> > @@ -203,6 +202,8 @@ int erofs_docker_config_lookup(const char *registry,
> >               }
> >
> >               entry = json_object_iter_peek_value(&it);
> > +                if (!entry)
> > +                     continue;
>
> The patch format is broken, also Chengyu could you review it?
>
> Thanks,
> Gao Xiang
>
> >               if (json_object_object_get_ex(entry, "auth", &auth_field)) {
> >                       b64 = json_object_get_string(auth_field);
> >                       if (b64 && *b64) {
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-16  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 19:14 [PATCH] erofs-utils: lib: fix potential NULL pointer dereference in docker_config.c Sri Lasya
2026-03-16  4:35 ` Gao Xiang
2026-03-16  9:01   ` Sri Lasya Prathipati

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox