Article 646EA CodeSOD: The Misleading PIN

CodeSOD: The Misleading PIN

by
Remy Porter
from The Daily WTF on (#646EA)

Tina needs to write some software that integrates with a hardware device. Thatdevice controls access via behind a PIN, and thus Tina's team needs to track the valid PIN, so that they can, via software, update or alter the PIN.

There's just one problem. That device has some opinions about how a Personal Identification Number should be represented:

 /// <summary> /// Gets or sets the department PIN. /// </summary> /// <value> /// The department PIN. /// </value> uint DepartmentPin { get; set; }

I love the useless comments, but even more I love the datatype: uint.

Now, you might think the PIN 0410 and 410 should be considered different PINs, but you'd be wrong.

This gets us back to the old problem in programming: just because something is called a number doesn't mean it's a numeric type. Whether it's phone numbers, zip codes, or PINs.

Tina doesn't share what this device controls access to, but swears: "It's not our fault. We don't make the device that accepts the PIN."

proget-icon.png [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments