Vulnerability Development mailing list archives

Re: Question about Data type in VB.NET


From: Vade 79 <v9 () fakehalo deadpig org>
Date: 22 Oct 2003 20:03:10 -0000

In-Reply-To: <20031022115713.10502.qmail () sf-www2-symnsj securityfocus com>

In VB.NET if we declare an int by default from what I understand it is a 32 bit int size ranges from -2,147,483,648 
through 2,147,483,647. The size range for short however is -32,768 through 32,767 and char is 0 through 65535 
(unsigned) (msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vagrpdatatype.asp). 

correction; char is 1-256.

think of how these are stored in memory, int = 4 byte comparison(256*256*256*256=4294967296), short = two byte 
comparison(256*256=65536), char = 1 byte(256).

by default these casts are signed, making it half negative and half positive like you show, so if you don't want the 
negative aspect use something like: unsigned int = 4294967295(==-1,max).

basically, use an "unsigned short" for a port value..


Current thread: