[Openvas-plugins] Superfluous calls to string() in plugins

Thomas Reinke lists at securityspace.com
Thu Sep 22 02:16:46 CEST 2011


Be careful of one thing, iirc there is a difference between

a = "hi\n";

and

a = string("hi\n");

The first, iirc, is a 4 character string nil terminated. The
second one is a 3 character string ('h', 'i', newline) nil
terminated.

Thomas

Henri Doreau wrote:
> Hello,
> 
> I've noticed that the NVTs contain numerous calls to the string()
> function with a single static string as parameter. Unless there is a
> reason for these calls (I can see none) it would probably worth
> avoiding them, as for each call the parameter is duplicated in memory.
> 
> If someone also wants to give a shot at removing the extra calls this
> would be very welcome! :-)
> 
> Regards.
> 



More information about the Openvas-plugins mailing list