All the calls to build_XXX assume you are not going to write passed the
allocated buffer, so no libnet does not verify that you are writing to
unallocated memory. 

The buffer is allocated once at libnet_init_packet which can take the size
of the packet, or a default value (LIBNET_MAX_PACKET_SIZE). 

I guess it is safe to assume that LIBNET_MAX_PACKET_SIZE will never change
for protocols using IP. So I could just create an SV that has either the
packet size argument or LIBNET_MAX_PACKET_SIZE by default.

Daniel.

> True wrt pointers in general, but libnet _has_ to store the 
> size of the
> packet data somewhere where you _can_ get at it, otherwise 
> you wouldn't be
> able to use any data past the first NUL. (Note that this 
> applies no matter
> what you do with the data - sv_setpvn or provide a method to 
> stringify it:
> you're in C, you have binary data, you _must_ have or be able 
> to derive the
> length, or you simply don't have enough information, right?)
> 
> 

Reply via email to