Fixed possible buffer overflow bug if RDB file is corrupted.

(Note: commit message modified by @antirez for clarity).