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

  • Doctors delays in treating patients results in early unnecessary deaths and dying before you have to
    ... If a patient is not treated properly due to a mistake in diagnosis, ... the doctor may be held liable for any further injury or damages. ... Medical Malpractice: Misdiagnosis and Delayed Diagnosis ... prior medications, allergies and time requirements of the operation to ...
    (soc.retirement)
  • Re: Study Confirms That Fox News Makes You Stupid
    ... It strikes me that the doctor that recommended the MRI must have been ... unsurprisingly - you see socialist medicine as denying a patient ... with removed stomach who also needed bone medication for other reasons. ... This would not have happened at our HMO. ...
    (sci.electronics.design)
  • Re: Study Confirms That Fox News Makes You Stupid
    ... It strikes me that the doctor that recommended the MRI must have been ... unsurprisingly - you see socialist medicine as denying a patient ... with removed stomach who also needed bone medication for other reasons.. ... This would not have happened at our HMO. ...
    (sci.electronics.design)
  • Hits on the very CONCEPT OF HEALTH CARE , while somepone hired Australia to diffuse and /or compare
    ... to hand them expensive new Medicaid obligations without money to pay ... Democratic leaders pushing major changes in the health care system are ... WHAT IS THE DIFFERENCE IN CASE THE BASIC, PRIMARY DOCTOR IS ... HOW MANY VISITS PATIENT IN MY SITIUATION WILL WASTE WITHOT GETTING ...
    (soc.culture.usa)
  • Re: Ping: Henry!
    ... feeling I get in my legs and lower body - like the feeling of electricity. ... Think Like a Doctor: A Father Loses Strength ... you?ll find a summary of a patient ... Dr. Samuels listened as the patient explained his medical history. ...
    (alt.support.diabetes)