Jim Lawless' Blog


The October 10th Bug

Originally published on: Fri, 7 Oct 2011.

The Y2K panic was not the first time I had encountered a date-oriented software bug. Years before Y2K problems were even a worry, I ran into a situation where an MS-DOS program written in C began to run amok on October 10th.

There had been no new releases of this particular program in months. It had behaved normally running continuously on an unattended PC in a computer room. Operators checked the computer every once-in-a-while to make sure that the messages on the screen were being updated. When they saw an error on the screen, they informed us that there was a problem.

We began to try to solve the problem by looking through the code and possible changes that could have occurred to the environment. We went over everything and had determined that there'd been no operating-system patches, nor updates to any of the files that could have affected the program.

The only thing that had changed before the problem manifested was the date.

The problem manifested as a hard-crash without any real debugging info present. We didn't often have the luxury of stack-traces, remote debuggers or things like that, so we kept trying to piece together where it was blowing up by introducing diagnostics into the code; re-release, re-test, ...etc.

The problem?

We were calling a function that placed the current date into a buffer in MM/DD/YY format. The buffer had been defined as a char[8]. Yes ... I know. A char[8] buffer only has enough room to hold the digits and the slashes and not the trailing string-terminator character. Yet, we didn't trip over this until October 10th.

October 10th happens to be the first day of the year where the month and day are both two-digit numbers. Since we had suppressed leading zeroes from the month and the day when formatting the date, there was never a combination of months and days that ever overflowed our buffer ... until 10/10.

We changed the buffer declaration to char[9] and the program was healthy once again.

Unless otherwise noted, all text is Copyright ©2011 by James K. Lawless.



Views expressed in this blog are those of the author and do not necessary reflect those of the author's employer. Views expressed in the comments are those of the responding individual.

stumbleupon Save to StumbleUpon
digg Digg it
reddit Save to Reddit
facebook Share on Facebook
twitter Share on Twitter
aolfav More bookmarks


Previous post: A Review of Kevin Mitnick's Book Ghost in the Wires
Next post:My Blog Engine


About Jim ...


Subscribe to this blog!



Subscribe via e-mail


Click **here**
to try out MailWrench;
a command-line SMTP /
SMTPS (Google Gmail)
mailer for Windows.


Follow me on Twitter

http://twitter.com/lawlessGuy


Recent Posts

A Forthcoming Marvel Movie Villain

Uninstalling Problematic Windows Software

Don't be Hatin'

A JavaScript REPL for Android Devices

MailSend is Free

My Blog Engine

The October 10th Bug

A Review of Kevin Mitnick's Book Ghost in the Wires


Random Posts

An Interview with Brad Templeton

Speeding up JRuby with NailGun

A GUI for urlx

Blog Posts by Category

A Command Line Scheduler

Structuring my Thinking

Envy

Invoking the Default Windows Screen-Saver

Java in a Windows EXE with launch4j

JRuby as a Java Obfuscation Utility


Full List of Posts

http://www.mailsend-online.com/bloglist.htm


Recent Posts from my Other Blog

Remembering Dr. San Guinary

Why Some Web Sites will go Dark on Jan 18th

SNL Superhero Skit

More Ruby Games

My Ruby Game Challenge Entry

Steal this Bookmarklet

Nerd Toys

Learn New Jargon, You Must

Spot the Wiebe

Tech Magazine Glory Days

Book Review : Paull Allen - Idea Man

A 90's Experiment in Online Systems - The U.S. West CommunityLink Service