1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Fixes a few buffer overflow problems with fixed size buffers.
--- a/main.c
+++ b/main.c
@@ -32,7 +32,7 @@
{
char *dev, *app;
dev = NULL;
- char *filter, *buffer, ldname[50];
+ char *filter, *buffer, *ldname;
char errbuf[PCAP_ERRBUF_SIZE];
extern char *optarg;
int option, option_index;
@@ -143,7 +143,7 @@
memset (&flags, 0, sizeof (struct FLAGSTRUCT));
flags.promisc = 1; /*default is promisc */
logname = filter = buffer = tcpdl = NULL;
- strcpy(ldname,"NULL");
+ ldname = NULL;
/* get global time */
tm = time(NULL);
@@ -260,7 +260,7 @@
/* only long options */
case '\0':
if (!strcmp(long_options[option_index].name,"ld"))
- strcpy(ldname,optarg);
+ ldname = optarg;
break;
default:
usage(argv[0]);
--- a/sniff.c
+++ b/sniff.c
@@ -38,7 +38,7 @@
ldd = NULL;
ld = 0;
npkt = 0;
- if (strcmp (ldname, "NULL")) /* != NULL */
+ if (ldname != NULL) /* != NULL */
(ld=1);
/* ask pcap for the network address and mask of the device */
|