improve the robustness of savedefault and default.

This commit is contained in:
okuji committed 2001-02-02 13:39:59 +00:00
1 parent 00865a8027
commit dc1c0a6ccf
3 files changed
+22 -1

No files matched your search

+8 -1
View File
@@ -3080,7 +3080,14 @@ savedefault_func (char *arg, int flags)
return 1;
}
entryno_ptr = (int *) ((char *) buffer + STAGE2_SAVED_ENTRYNO);
/* Sanity check. */
if (buffer[STAGE2_STAGE2_ID] != STAGE2_ID_STAGE2)
{
errnum = ERR_BAD_VERSION;
return 1;
}
entryno_ptr = (int *) (buffer + STAGE2_SAVED_ENTRYNO);
/* Check if the saved entry number differs from current entry number. */
if (*entryno_ptr != current_entryno)