PDA

View Full Version : zero padding


othe
June 27th, 2009, 05:22
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
June 27th, 2009, 20:25
i want to do in C language for example the 123 to be 1230000000000

aragon
July 2nd, 2009, 18:12
Post your C app without the padding functionality and I'm sure someone can show you how to make it do the padding...

iic2
July 3rd, 2009, 08:02
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=322e3095597521d1316769e9008381 bb&topic=7732.0

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

Djn
July 3rd, 2009, 17:34
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
July 3rd, 2009, 17:42
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