memcpy check

This is a discussion on memcpy check within the C Programming forums, part of the General Programming Boards category; Hi, does anybody knows a compiler or tool that test memcpy's for correct size of arg1 and length(arg3) so that ...

  1. #1
    Unregistered
    Guest

    Unhappy memcpy check

    Hi,

    does anybody knows a compiler or tool that test memcpy's for correct size of arg1 and length(arg3) so that it fits and dont copy over the end of arg1 and cause a fault ?!

    (arg1 points to a structure)


    thanx
    daniel

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    36
    void *memcpy( void *dest, const void *src, size_t count );

    dest : New buffer

    src : Buffer to copy from

    count : Number of characters to copy
    ~~~~~~~~~~~~~~~~~~~~~~~~

    The memcpy function copies count bytes of src to dest. If the source and destination overlap, this function does not ensure that the original source bytes in the overlapping region are copied before being overwritten. Use memmove to handle overlapping regions.

  3. #3
    Registered User Engineer's Avatar
    Join Date
    Oct 2001
    Posts
    125
    Daniel,

    If you want to make sure that there are no memory leaks in your code and you want to be sure that you are manipulating memory correctly, you can use "Mpatrol". This is a free open-source library avaliable especially for those type of things. It works on Windows NT and most UNIX flavours.

    Hope this helps,

    Cheers.
    1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-06-2010, 12:42 AM
  2. Atomic integers & memcpy()
    By rasta_freak in forum C Programming
    Replies: 11
    Last Post: 08-05-2008, 01:08 PM
  3. How can i check a directory for certain files?
    By patrioticpar883 in forum C++ Programming
    Replies: 13
    Last Post: 02-01-2008, 05:27 PM
  4. how to check input is decimal or not?
    By kalamram in forum C Programming
    Replies: 3
    Last Post: 08-31-2007, 08:07 PM
  5. Please check this loop
    By Daesom in forum C++ Programming
    Replies: 13
    Last Post: 11-02-2006, 01:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21