diff -up devil-1.7.8/src-IL/src/il_dicom.c~ devil-1.7.8/src-IL/src/il_dicom.c --- devil-1.7.8/src-IL/src/il_dicom.c~ 2009-03-08 08:10:09.000000000 +0100 +++ devil-1.7.8/src-IL/src/il_dicom.c 2009-12-03 12:07:45.000000000 +0100 @@ -427,9 +427,11 @@ ILboolean GetUID(ILubyte *UID) return IL_FALSE; ValLen = GetLittleUShort(); + if (ValLen > 64) + return IL_FALSE; if (iread(UID, ValLen, 1) != 1) return IL_FALSE; - UID[64] = 0; // Just to make sure that our string is terminated. + UID[ValLen] = 0; // Just to make sure that our string is terminated. return IL_TRUE; }