In the unlikely case of an all-zero tag, rc_file2.c:store() could
mistake an empty record for a replay. Check that records from the
file are non-empty (by checking that the timestamp is non-zero) before
comparing them to the tag.
ticket: 8786
if (ret)
return ret;
- if ((nread >= 1 && memcmp(r1tag, tag, TAG_LEN) == 0) ||
- (nread == 2 && memcmp(r2tag, tag, TAG_LEN) == 0))
+ if ((nread >= 1 && r1stamp && memcmp(r1tag, tag, TAG_LEN) == 0) ||
+ (nread == 2 && r2stamp && memcmp(r2tag, tag, TAG_LEN) == 0))
return KRB5KRB_AP_ERR_REPEAT;
/* Make note of the first record available for writing (empty, beyond