andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

Exception thrown - Index out of bounds in Utilities.cs DecodeQuotedPrintable #117

Closed 537mfb closed 11 years ago

537mfb commented 11 years ago

Where you have

            if ((b == eq) && ((i + 1) < data.Length))
            {
                    byte b1 = data[i + 1], b2 = data[i + 2];

You should have

            if ((b == eq) && ((i + 1) < data.Length - 1))
            {
                    byte b1 = data[i + 1], b2 = data[i + 2];

this prevents data[i + 2] froma throwing an Index out of bounds exception on certain messages

537mfb commented 11 years ago

making it

            if ((b == eq) && ((i + 2) < data.Length))
            {
                    byte b1 = data[i + 1], b2 = data[i + 2];

Will work too

andyedinborough commented 11 years ago

do you have an example this fails on so I can write a test for it?