MD5: add a missing bounds check

Change-Id: I866d434953b3479de9c482b9fb311b93d8e9aec9
MD5: handle no newline at end of nandroid.md5

If there is no newline at the end of nandroid.md5, then fgets will not
have '\n' as the last character for the last line. Make sure we aren't
replacing the last legitimate character of a string when reading the
file.

Change-Id: I3664582d7b13a2171bf074a236b44db104bb975a
Merge remote-tracking branch 'cm/cm-11.0' into kk4.4