Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:41:12+00:00 2026-06-02T19:41:12+00:00

I read this article recently , and I tried overriding the libc printf function

  • 0

I read this article recently, and I tried overriding the libc printf function with a doing the following for fun :-

  • Create an executable that uses printf to print this is a test(printer.c)
  • Create an c file with a custom puts to print muhahaha, this is a test(custom.c)
  • Create an object file gcc -fPIC -g -c -Wall custom.c
  • Create an so file gcc -shared -Wl,-soname,libmystuff.so.1 -o libmystuff.so.1.0.1 custom.o
  • I add the directory which contains the so file into the LD_PRELOAD environment variable. export LD_PRELOAD=$(pwd)
  • Try running printer

I’d imagine that muhahaha, this is a test would be printed out but it seems like im doing something wrong. Have I got some concept wrong? Or am I just doing something wrong?

[EDIT]

The code snippets involved are :-

// printer.c
int main() {
printf("this is a test");
return 0;
}

// custom.c
void printf(char *t) {
puts("muhahaha, this is a test");
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:41:13+00:00Added an answer on June 2, 2026 at 7:41 pm

    You’re supposed to name the library in the LD_PRELOAD environment variable, not the directory.

    export LD_PRELOAD=/path/to/libmystuff.so.1.0.1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've recently read this article on using printf and scanf in assembly: Meaning of
after read this article i tried generate EF model by System.Diagnostics.Process: Process myProcess =
Recently, I read this article: http://download.oracle.com/javase/tutorial/extra/generics/wildcards.html My question is, instead of creating a method
I have recently read the safe bool idiom article. I had seen this technique
Recently I've read this article: http://www.smashingmagazine.com/2009/09/25/svn-strikes-back-a-serious-vulnerability-found/ Developers of many popular sites like apache.org, php.net
I recently read this article . Which uses the Silverlight Bing maps control to
I recently read this article Safe Thread Synchronization as I was curious about the
I read this article here http://www.codeproject.com/KB/web-security/RolesFormsAuthorization.aspx What is the limitation of Membership that would
I recently read this article on smart use of ViewState and am particularly interested
Recently I read this Wikipedia article regarding the Dining Philosophers problem but I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.