It is very much a
footrace: if the vulnerability exists, who will find it first? The purpose of this chapter is to
give you the survival skills necessary to understand upcoming chapters and later to find
the holes in software before the black hats do.
C Programming Language
The C programming language was developed in 1972 by Dennis Ritchie from AT&T Bell
Labs. The language was heavily used in Unix and is thereby ubiquitous. In fact, much of
the staple networking programs and operating systems are based in C.
121
Gray Hat Hacking: The Ethical Hacker??™s Handbook
122
Basic C Language Constructs
Although each C program is unique, there are common structures that can be found in
most programs. We??™ll discuss these in the next few sections.
main()
All C programs contain a main structure (lowercase) that follows this format:
main() {
;
}
where both the return value type and arguments are optional. If you use command-line
arguments for main(), use the format:
main(int argc, char * argv[]){
where the argc integer holds the number of arguments, and the argv array holds the
input arguments (strings).
Pages:
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274