remy porter remy escaped the enterprise world and now works as a consultant. editor-in-chief for tdwtf. 




brandon <u+2019>s company had a lot of work to do, and not enough staff to do it, so they hired on some freelancers. they were careful about it, and felt like they<u+2019>d hired some good people. one developer, in particular, was the kind of developer who not only understands the low-level windows api, but actually knows how to use some of the undocumented corners of it to get things done. 




most of the module was pretty good, but when brandon double checked on the method for escaping disallowed characters from a url, he found some problems. 




the function went character by character through the string, which was bad enough, but when it wanted to know if a certain character needed to be escaped or not, it called this function: bool needescape ( wchar_t c ) { switch ( c ) { case l'0': case l'1': case l'2': case l'3': case l'4': case l'5': case l'6': case l'7': case l'8': case l'9': case l'a': case l'b': case l'c': case l'd': case l'e': case l'f': case l'g': case l'h': case l'i': case l'j': case l'k': case l'l': case l'm': case l'n': case l'o': case l'p': case l'q': case l'r': case l's': case l't': case l'u': case l'v': case l'w': case l'x': case l'y': case l'z': case l'a': case l'b': case l'c': case l'd': case l'e': case l'f': case l'g': case l'h': case l'i': case l'j': case l'k': case l'l': case l'm': case l'n': case l'o': case l'p': case l'q': case l'r': case l's': case l't': case l'u': case l'v': case l'w': case l'x': case l'y': case l'z': case l'-': case l'.': case l'_': case l'~': return false; default: return true; break; } } 




while this freelancer may have been an expert on the undocumented windows apis, they didn<u+2019>t quite know their way around the documented ones . [advertisement] otter allows you to easily create and configure 1,000's of servers, all while maintaining ease-of-use, and granular visibility down to a single server. find out more and download today!
codesod: just in case
remy porter