Skip to Main Content
Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals
book

Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals

by James C Foster
April 2005
Intermediate to advanced content levelIntermediate to advanced
700 pages
20h 39m
English
Syngress
Content preview from Sockets, Shellcode, Porting, and Coding: Reverse Engineering Exploits and Tool Coding for Security Professionals
96 If the source buffer is greater than the destination buffer, an overflow will occur.
Also, ensure that the destination buffer is null terminated to prevent future functions
that utilize the destination buffer from having any problems.
97
98
Example insecure implementation snippet:
99 char dest[20];
100 gets(dest);
101
102
Example secure implementation snippet:
103 char dest[20] = {0};
104 fgets(dest, sizeof(dest)-1, stdin);
105
106
Function name: fgets
107 Class: Buffer Overflow
108 Prototype: char *fgets(char *s, int size, FILE *stream);
109 Include: #include <stdio.h>
110 Description:
111 If the source buffer is greater than the destination buffer, an overflow will occur.
Also, ensure that the destination buffer is null terminated to prevent future functions ...
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

32/64-Bit 80x86 Assembly Language Architecture

32/64-Bit 80x86 Assembly Language Architecture

James Leiterman

Publisher Resources

ISBN: 9781597490054