tech:notes_langage_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:notes_langage_c [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:notes_langage_c [2025/10/05 02:24] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 51: | Ligne 51: | ||
| + | == Surcharger un symbole | ||
| + | |||
| + | Voir : | ||
| + | https:// | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | Is the application linked statically? | ||
| + | |||
| + | If not, you may override some symbols, for example, let's redefine socket: | ||
| + | |||
| + | int socket(int domain, int type, int protocol) | ||
| + | { | ||
| + | write(1," | ||
| + | return -1; | ||
| + | } | ||
| + | |||
| + | Then build a shared library: | ||
| + | |||
| + | gcc -fPIC -shared test.c -o libtest.so | ||
| + | |||
| + | Let's run: | ||
| + | |||
| + | nc -l -p 6000 | ||
| + | |||
| + | Ok. | ||
| + | |||
| + | And now: | ||
| + | |||
| + | $ LD_PRELOAD=./ | ||
| + | Error | ||
| + | Can't get socket | ||
| + | |||
| + | What happens when you run with variable LD_PRELOAD=./ | ||
| + | |||
| + | |||
| + | |||
| + | == Sécurité | ||
| + | |||
| + | <code -> | ||
| + | $ man gets | ||
| + | |||
| + | ... | ||
| + | (DEPRECATED) | ||
| + | Never use this function. | ||
| + | |||
| + | BUGS | ||
| + | | ||
| + | | ||
| + | |||
| + | For more information, | ||
| + | ... | ||
| + | </ | ||
tech/notes_langage_c.1742825205.txt.gz · Dernière modification : de 127.0.0.1
