← Back to team overview

drizzle-discuss team mailing list archive

Re: Bug in rplugin-drizzle-protocol

 

On 06/22/2010 04:33 PM, Andrew Hutchings wrote:
> Hi Vijay,
> 
> I think I found the problem in your branch.  In loader.cc
> 
>     /* Copy the left over options back into argv for further processing.
>        Once the core is using program options, this whole thing will be
> done
>        differently.
>      */
>     for (vector<string>::iterator iter= to_pass_further.begin();
>          iter != to_pass_further.end();
>          ++iter)
>     {
>       size_t pos= iter-to_pass_further.begin()+1;
>       memcpy(argv[pos], (*iter).c_str(), (*iter).size()+1);
>       cout << "arg: *" << argv[pos] << "*" << endl;
>     }
> 
> 
> So as options are consumed they are being put back into argv into
> different positions.  Since argv[pos] could be allocated for a different
> length than the variable being shoved in at the time you can get in a
> big mess.
> 

YES! headsmack. of course.

Ok. I have ideas now of how to deal with this. Actually - I have ideas
that will make the code even easier.

VJ - I'll make a patch for you in just a bit.

Thanks Andrew!



Follow ups

References