DEV Community

Discussion on: What was the worst bug you've ever written?

Collapse
 
entelodon profile image
Kristian Tsivkov • Edited

Well.. well.. well.
It's not a bug, but definitely something funny..
While testing regular expressions in C, I was trying to get just the contents of the files in a directory ignoring the white spaces, and export the result in new files. That's good, but running something like this: "[\s](.*)" and exporting the results in files in the same directory you are "scanning" is a bad idea. Running it with sudo on the server where your website is hosted is even worse. Before you realize what's wrong you are going to be dropped from ssh, the cpu will be 100% and your disk will be busy. Feels like an internal DoS.