Nmap Development mailing list archives

Re: [PATCH] ipOps.lua ensure that a number is passed to stdnse.tohex()


From: Sven Klemm <sven () c3d2 de>
Date: Tue, 07 Oct 2008 10:13:19 +0200

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Patrick Donnelly wrote:
| On Mon, Oct 6, 2008 at 8:17 PM, Fyodor <fyodor () insecure org> wrote:
|> On Tue, Oct 07, 2008 at 03:10:19AM +0100, jah wrote:
|>> The attached fixes an error in ipOps.ip_to_bin() when a string is
passed
|>> to stdnse.tohex().  This should always be (and should always have
been)
|>> a number.
|> Thanks Jah, I've checked this in.
|>
|> -F
|
| I've just applied a patch to stdnse.tohex to automatically coerce
| strings to a number if possible for the first argument.

I've reverted this because tonumber() discards whitespace.
tonumber(" 1\r\n") will result in 1.

But even without the discarding I think tohex() shouldn't try any
conversions as this removes control over the conversion from the
caller. tohex() shouldn't decide on it's own how to handle a string
that can be converted to a number but should handle all strings the same.

Cheers,
Sven

- --
Sven Klemm
http://cthulhu.c3d2.de/~sven/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjrGh8ACgkQevlgTHEIT4aOTgCfS5dNqpVQkGXpMpEKY6ONKHIE
5uUAnjPzFa7MWgkmQUohcjfbOtOHEsZW
=5uzq
-----END PGP SIGNATURE-----

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org


Current thread: