# zero padding



## othe (Jun 27, 2009)

i want to zero pad some data to be sent. i want the zeros to be put in the end. for example that i want to zero pad the icmp data to be a total of 60 bytes. does anyone know how to do that?


----------



## othe (Jun 27, 2009)

i want to do in C language for example the 123 to be 1230000000000


----------



## aragon (Jul 2, 2009)

Post your C app without the padding functionality and I'm sure someone can show you how to make it do the padding...


----------



## iic2 (Jul 3, 2009)

This is in assembler but hopefully it will give you an idea if not convert you to use Nasm or Fasm for BSD. Preliminary Masm has the most examples but translation is  really fun and easy even to C. As  aragon indicated, you always must post your sample code in asm or C to get anywhere in this game.  You got the key-word.

I'll be with you soon 

http://www.masm32.com/board/index.php?PHPSESSID=322e3095597521d1316769e9008381bb&topic=7732.0

http://board.flatassembler.net/search.php?mode=results


----------



## Djn (Jul 3, 2009)

If this is C, why not just malloc 60 bytes, bzero/memset them to 0, write the data into that area, and send off the entire 60 bytes?


----------



## iic2 (Jul 3, 2009)

I don't know C coding yet but I think this may help.

http://www.stylusstudio.com/xsllist/200008/post11600.html

http://tools.ietf.org/html/draft-bonica-internet-icmp-16


----------

