Re: How to take down a system to the point of requiring a newfs with one line of C (userland)



Patient: Doctor, it hurts when I do this!

Doctor: Don't do that...

On Feb 18, 2008 1:23 PM, Dag-Erling Smørgrav <des@xxxxxx> wrote:
Jim Bryant <freebsd@xxxxxxxxxxxxxxxxx> writes:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) { int i; char buf[1024]; bzero(buf, 1024); for(i = 0; i < 10000; i++) { sprintf(buf, "touch %s%05d\n", argv[1], i); system((const char *)buf);} return(0);}

Subject should be "how to take down a system [...] with three lines of
badly written C, provided you have root privileges already and are too
lazy to just dd if=/dev/zero of=/dev/ad0s1 count=100", which would
accomplish the job much faster.

Purely in the interest of showing off, here is my version. It is 81
bytes shorter than yours, it is valid C99 with POSIX extensions (yours
is not), and it produces 11,450 files in about 0.2% of the time yours
takes to produce 10,000.

#include <unistd.h>
#define b(i,v) for(int v=48;v<127;++v){f[i]=v;
#define a(i) b(i,v##i)
int main(void){char f[5]={'/'};a(1)a(2)a(3)truncate(f,0);}}}}

DES
--
Dag-Erling Smørgrav - des@xxxxxx

_______________________________________________
freebsd-security@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-security
To unsubscribe, send any mail to "freebsd-security-unsubscribe@xxxxxxxxxxx"

_______________________________________________
freebsd-security@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-security
To unsubscribe, send any mail to "freebsd-security-unsubscribe@xxxxxxxxxxx"
_______________________________________________
freebsd-stable@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Phyllis: Activists Say YIKES We need to KILL the MD BILL! LOL
    ... Medicare makes it illegal for a doctor to ... > groups which work to inform doctors outside of patient visits in the ... And Lyme "patient advocates" are all for legislation which would ...
    (sci.med.diseases.lyme)
  • Re: Alfred Cutner, Gyneacologist
    ... Referral or not it's the patients job to hammer the doctor ... have one patient to be concerned with, ... surgery, I was given 4 weeks notice before admission. ... primarily through the presence of Alfred Cutner who had no ...
    (alt.support.chronic-pain)
  • Strawman argument from RM
    ... neither the doctor nor the patient wins. ... I too work at both a private practice setting and an optical chain. ... My bias is against the retail opticals, ...
    (sci.med.vision)
  • Re: TADOTable Error without persistent fields
    ... Patient: "Doctor, it hurts when I do this...." ... Your cured, here is my bill" ...
    (borland.public.delphi.database.ado)
  • Doctor not criminally liable if patient dies due to error: SC
    ... Doctor not criminally liable if patient dies due to error: ... the Supreme Court ... The Bench said for fixing criminal liability on a doctor ...
    (sci.med)