Are you looking for my non-technical blog?

This is now my technical-only blog, my non-technical blog is here.

15 December 2005

C - Hex Dump Function

Every sniffer has a hex dump function in order to print the captured packets to the user, so this is a hex dump function I made ... mycap_dump()

Tags: , ,

4 comments:

  1. well, something is wrong with that code i don't understand. It caused a buffer overflow. How can this be avoided?

    "The value of ESP
    was not properl
    y saved across a
    function call.
    This is usually
    a result of cal
    ling a function
    declared with on
    e calling conven
    tion with a func
    tion pointer dec
    lared with a dif
    ferent calling c
    onvention. .onex
    it.c
    FFF.FFFFFFFF.FFF

    .75.66.2E ..@.
    c...str != NULL.
    flag == 0 || fla
    g == 1..........
    .........EEE....
    .50.P.... (8PX.."

    ReplyDelete
  2. Actually I don't understand you what do you mean by ESP, and can you send me the code where the BoF has occured !?

    ReplyDelete
  3. ESP is the extended Segment Pointer, a register in the processor that point to the current memory segment in ram.

    ReplyDelete
  4. OIC, so you found that by using GDB or some simillar debugger right ?
    As far as I see, it seems that you have called the function using a pointer to something that is not char*
    So let me do some changes (I'll replace that char* with void*) and try usin it now.

    ReplyDelete