5th Underhanded C Contest Now Open 162
Xcott Craver writes "The next Underhanded C Contest has begun, with a deadline of March 1st. The object of the contest is to write short, readable, clear and innocent C code that somehow commits an evil act. This year's challenge: write a luggage routing program that mysteriously misroutes a customer's bag if a check-in clerk places just the right kind of text in a comment field. The prize is a gift certificate to ThinkGeek.com."
Re:Easy? (Score:5, Informative)
I'm really impressed (Score:4, Informative)
I've read the entire blog, and I must say, I'm impressed. Very impressed. Very, very impressed.
The person who writes the criteria knows what he's/she's writing about.
And the winners who submit the results are really, really good.
Totally opposite (Score:5, Informative)
The true "Underhanded" program would be one that was perfectly readable, so readable in fact that you totally overlook the sneaky thing it was doing because what you think it's doing seems so clear.
The ObsfuC contest is all about code that even after staring you can't tell what the heck is going on.
Re:Easy? (Score:1, Informative)
Properly done there would be no boolean indicating the presence of the comment, and the value of "Destination" might never change. Instead at the end there would be some code that verified that all fields were properly formatted and send them to the printer, and some clever code at this point would subtly change what was outputted as the destination based on the contents of a particular comment field. Maybe some combination of the conditional operator and regular expressions would allow you to cleverly add 1 to all numbers in the destination if some condition is true, such that "1234 main street" becomes "2345 main street". (Something more clever then "comment == 'top-heavy'", based on regular expressions and/or hashes)
But yea, doing it such that not only can nobody tell what's happening but such that they don't know *anything* is happening is difficult. That's why it's a contest.
Re:For extra points: (Score:3, Informative)
Re:Easy? (Score:1, Informative)
Well if you think it's easy, why not try submitting something? There's a good chance the winners will have far better solutions than you were expecting.
Remember there's a few parts to this. It's supposed to be simple, hidden in plain sight, and once discovered, it can't look intentional.
Read the challenge. If your program mentions anything at all having to do with loading, or positioning of the luggage, it's thrown out. Those concepts have nothing to do with the code that is being written. Your code simply parses standard in, and spits out pieces of that standard in based on command line arguments. Anything that goes astray from that is suspect.
I think I know what my submission will be :)
Write up of last entry (Score:5, Informative)
I am the winner of the previous underhanded C contest. If anyone is interested, I wrote up a description of my entry on my blog here: http://notanumber.net/archives/54/underhanded-c-the-leaky-redaction [notanumber.net]
It was a fun contest to enter and now I can shop at thinkgeek for silly gadgets without feeling guitly :)