Thread: Can gethostbyname be exploited?

  1. #1
    Registered User
    Join Date
    Feb 2019
    Posts
    69

    Can gethostbyname be exploited?

    Hey,

    I wondered about the function:

    gethostbyname(argv[2]);

    can this be exploited by an Bufferoverflow attack?

    Thank you!

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If we exclude possible implementation-specific bugs, no.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Feb 2019
    Posts
    1,078
    OBS: gethostbyname() and gethostbyaddr() are deprecated since 2008 (POSIX-1:2008). Use getaddrinfo() and getnameinfo().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gethostbyname
    By TenFold in forum Networking/Device Communication
    Replies: 11
    Last Post: 05-06-2006, 04:41 AM
  2. GetHostByName
    By maxorator in forum C++ Programming
    Replies: 3
    Last Post: 11-04-2005, 02:08 PM
  3. gethostbyname
    By shawn_drn in forum C Programming
    Replies: 1
    Last Post: 02-13-2005, 03:24 PM
  4. gethostbyname
    By Micko in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-11-2004, 12:21 PM
  5. gethostbyname()
    By jchanwh in forum C Programming
    Replies: 1
    Last Post: 12-25-2001, 10:02 PM

Tags for this Thread