[Plugins-writers] Weird behavior with substr

From: Jon Passki (cykyc@private)
Date: Thu Oct 06 2005 - 10:29:55 PDT


Hello All,

I'm noticing weird behavior with substr and am wondering if this is
excepted behavior.  Here's an example:

poo.nasl:

stuff = "nessus";

c = display ("Stuff: " + stuff + "\n");
display ("c: " + c + "\n");
newst = substr(stuff,0);
c = display ("Stuff: " + stuff + "\n");
display ("c: " + c + "\n");
c = display ("Newst: " + newst + "\n");
display ("c: " + c + "\n");
c = display ("Stuff: " + stuff + "\n");
display ("c: " + c + "\n");

<output>
> nasl poo.nasl
** WARNING : packet forgery will not work
** as NASL is not running as root
Stuff: nessus
c: 14
Stuff: nessus
c: 14
Newst: nessus\nc: 15
Stuff: nessus
c: 14
> 


I would expect ``c = display ("Newst: " + newst + "\n");'' to
properly linefeed the string.  It's like there isn't a string
termination in there for display() to see the end of newst, so it
thinks the "\n" is part of the string. It's not until the next
display function is called that the string is terminated.

So, am I missing something or is this expected behavior?  How can I
force a termination on newst if this is expected behavior?

TIA,

Jon






		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com
_______________________________________________
Plugins-writers mailing list
Plugins-writers@private
http://mail.nessus.org/mailman/listinfo/plugins-writers



This archive was generated by hypermail 2.1.3 : Thu Oct 06 2005 - 10:30:16 PDT