Out-of-bound read on printf() reported by purify

This is a discussion on Out-of-bound read on printf() reported by purify within the C Programming forums, part of the General Programming Boards category; I am using a popular memory checker "purify" to check my code. It reports "Out-of-bound read" (ABR) for the following ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    98

    Out-of-bound read on printf() reported by purify

    I am using a popular memory checker "purify" to check my code. It reports "Out-of-bound read" (ABR) for the following printf statements:
    Code:
    struct passwd *pwuid = getpwuid(getuid());
    static const char *compiler = "GCC";
    printf("%s", compiler);
    printf("%s", __DATE__);
    printf("%s", pwuid->pw_dir);
    It seems it gives this out-of-bound read for any printf() that involves %s. The purify users guide and ref manual do not give aclue.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It wasn't that hard to find.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    98
    Quote Originally Posted by quzah
    It wasn't that hard to find.
    None of the first 10 results in that search page answers my question.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,045
    Perhaps your question has been answered on this forum: http://www-128.ibm.com/developerwork...=118571&cat=24

    Maybe you should try a different compiler if you suspect the standard library.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. IF CONDITION plese help
    By birumut in forum C Programming
    Replies: 12
    Last Post: 03-06-2009, 08:48 PM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 04:42 PM
  3. program not working...please look at this
    By JOlszewski in forum C Programming
    Replies: 3
    Last Post: 01-30-2006, 09:33 PM
  4. help with switch statements
    By Wexy in forum C Programming
    Replies: 3
    Last Post: 11-06-2002, 04:44 PM
  5. the bubble sort doesn't work help
    By Matt in forum C Programming
    Replies: 2
    Last Post: 12-13-2001, 05:14 PM

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