|
|||||||||||
|
Re: Administrivia: List Announcement
From: Benjamin A. Okopnik <ben(at)callahans.org>
Date: Tue May 13 2003 - 23:25:18 EDT
On Tue, May 13, 2003 at 01:36:24PM -0400, David Riley wrote:
[ snip ] > I'll start by saying that I like this idea... it'll give me a chance to
It "works" for me on a Debian Linux box: ben@Fenrir:/tmp$ ./vulndev-1 `perl -we'print "A" x 253'` a Segmentation fault Note that it does _not_ crash in the reverse case (large argv[2]), although I'm not sure why. However, this might be indicative (pardon my rusty-as-can-be C skills): #include <stdio.h> #include <string.h> #include <stdlib.h> #define SIZE 252
int
int i, l1, l2, s1, s2;
char *p1, *p2;
char *buf1 = malloc(SIZE);
char *buf2 = malloc(SIZE);
if (argc != 3)
exit(1);
p1 = argv[1], p2 = argv[2];
strncpy(buf2, p2, SIZE);
for (i = 0; i <= SIZE && p1[i] != '\0'; i++)
buf1[i] = p1[i];
l1 = strlen(p1);
s1 = sizeof(p1);
l2 = strlen(p2);
s2 = sizeof(p2);
free(buf1);
free(buf2);
printf("strlen1: %i sizeof1: %i\n", l1, s1);
printf("strlen2: %i sizeof2: %i\n", l2, s2);
return 0;
} Now, note the output of this:
ben@Fenrir:/tmp/vuln-dev$ ./tst `perl -we'print "A" x 252'` a
strlen1: 252 sizeof1: 4
Seems like "argv[2]" is copied no matter what the "strncpy"'s SIZE is. Hmm. Anybody have an idea?
Ben Okopnik
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:39 EDT |
||||||||||
|
|||||||||||