4 ms·
About twelve years ago, I wrote a CGI script with a loop like "for(i=10;i>0;i++){}", with the counter going in the wrong direction. Since it was running as apac
by Tangaroa 14y ago
About twelve years ago, I wrote a CGI script with a loop like "for(i=10;i>0;i++){}", with the counter going in the wrong direction. Since it was running as apache, I did not have rights to kill it. My buddy used this server for his business and I had DOSed it for about fifteen minutes until the integer overflowed. If the language had used a bignum, it would have been worse.
I made as similar mistake on the school's server a couple of years later when I had an infinite loop in an XSLT file that I was developing. Fortunately, libxslt had a way of detecting infinite loops in which it logged a warning to /var/log/messages and, far less fortunately, repeated the loop. Once again, I did not have rights to stop it and I had run it on a weekend when nobody was working. The hard drive was full well before anyone came in to work on Monday.
Lessons learned: Test web-based programs from the command line whenever possible. If you're a server admin, let your users' CGIs run under their identities and consider using resource limits.