Flagstone Software

12730. FSSerialNumber does not decode if string contains null.

If the serial number string contains a null byte then the code decoding the string will terminate early and an FSCoderException will be thrown reporting an underflow error. Also if the string is not null-terminated then the decoding will run past the end of the data structure and an overflow exception will be reported.

Root Cause

The root cause is the decode(FSCoder coder) method. It reads the string expecting it to be terminated by a null. The correct way should be to decode a string with the correct number of bytes regardless of whether the string contain nulls.

Workaround?

There is no workaround however changing he source code is simple. In FSSerialNumber.java change line 162 from:

serialNumber = coder.readString();

to force the full length to the string to be read:

serialNumber = coder.readString(length);

When will it be fixed?

This was fixed in Transform 2.1.6 released on 31-Dec-2007