Skip to Content
Hacking: The Art of Exploitation, 2nd Edition
book

Hacking: The Art of Exploitation, 2nd Edition

by Jon Erickson
January 2008
Beginner to intermediate
480 pages
12h 58m
English
No Starch Press
Content preview from Hacking: The Art of Exploitation, 2nd Edition

Buffer Restrictions

Sometimes a program will place certain restrictions on buffers. This type of data sanity-checking can prevent many vulnerabilities. Consider the following example program, which is used to update product descriptions in a fictitious database. The first argument is the product code, and the second is the updated description. This program doesn't actually update a database, but it does have an obvious vulnerability in it.

Buffer Restrictions

update_info.c

#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_ID_LEN 40 #define MAX_DESC_LEN 500 /* Barf a message and exit. */ void barf(char *message, void *extra) { printf(message, extra); exit(1); } /* Pretend this function updates a product description in a database. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands on Hacking

Hands on Hacking

Matthew Hickey, Jennifer Arcuri
The Complete Ethical Hacking Course

The Complete Ethical Hacking Course

Codestars By Rob Percival, Atil Samancioglu

Publisher Resources

ISBN: 9781593271442Supplemental ContentErrata Page