udhcpc6 segfault

Denys Vlasenko vda.linux at googlemail.com
Wed Aug 15 16:57:24 UTC 2012


On Tue, Aug 14, 2012 at 4:06 PM, Pramod Bhagwat <prbhagwat at gmail.com> wrote:
> static char **fill_envp(struct d6_packet *packet)
> {
>         char **envp, **curr;
>
>         client6_data.env_ptr = NULL;
>         client6_data.env_idx = 0;
>
>         *new_env() = xasprintf("interface=%s", client_config.interface);
>
>         if (packet)
>                 option_to_env(packet->d6_options, packet->d6_options +
> sizeof(packet->d6_options));
>
>         envp = curr = client6_data.env_ptr;

  bb_error_msg("curr:%p", curr);
  bb_error_msg("curr[0]:%p", curr[0]);

>         while (*curr)

  {
  bb_error_msg("*curr:%p", *curr);
  bb_error_msg("*curr:'%s'", *curr);

>                 putenv(*curr++);

  }

>
>         return envp;
> }
>
> In the above code while accessing curr pointer it is giving the
> segmentation fault.
> But client6_data.env_ptr is not NULL.

Please add bb_error_msg's as shown above, run udhcpc6 again and
let me know what it printed.

-- 
vda


More information about the busybox mailing list