The Search:
http://www.google.com/codesearch
Simple Buffer Overflows
Link: wikipedia Buffer_overflow
Search
lang:"c" strcpy buffer argv
or simply
buffer "should be big enough"
Using Google Code Search:
Found Examples of InSecure (Purposeful) Coding..Google Code Search
/* vuln.c */
#include
int main(int argc, char * argv [])
{
char buffer [500];
if (argc > 1)
strcpy(buffer, argv[1]);
return (0);
}
#include
int main(int argc, char * argv [])
{
char buffer [500];
if (argc > 1)
strcpy(buffer, argv[1]);
return (0);
}
Finding Examples of correct implentation..Google Code Search
*hostdir = malloc(sizeof(char[strlen(argv[1])+1]));
/* separate hostname and dirname from 'hostname:dirname' format */
strcpy(hostdir, argv[1]);
/* separate hostname and dirname from 'hostname:dirname' format */
strcpy(hostdir, argv[1]);
Possible Example of Real Vulnerability Finding... in Nachos Example Operating System
#ifdef DEBUG
int main (int argc, char *
argv[]) {
char buffer[80];
printf ("string = %s.\n", strcpy (buffer, argv
[1]));
}
#endif
int main (int argc, char *
argv[]) {
char buffer[80];
printf ("string = %s.\n", strcpy (buffer, argv
[1]));
}
#endif
Link:Google Code Search
Site:Nachos URL
No comments:
Post a Comment